Skip to main content

基于关键词匹配的文档知识库,使用 jieba 分词 + SQLite 倒排索引

Project description

po-docs-db

基于关键词匹配的文档知识库,使用 jieba 分词 + SQLite 倒排索引,提供中文/英文混合的关键词搜索。

安装

pip install po-docs-db

使用

from po_docs_db import PoDocsDB

docs = PoDocsDB(db_path="./data/docs.db", docs_dir="./docs")

# 写入文档
docs.write(
    type="前端",
    lang="vue",
    question="Font Awesome 在 Vue 中如何使用",
    doc_name="fontawesome-usage",
    content="# Font Awesome\n...",
)

# 查询
result = docs.query(type="前端", lang="vue", query="fontawesome 图标")
for item in result.results:
    print(f"{item.doc_path} | 匹配 {item.match_count} 个词: {item.matched_words}")

# 关闭
docs.close()

许可证

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

po_docs_db-0.1.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

po_docs_db-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file po_docs_db-0.1.0.tar.gz.

File metadata

  • Download URL: po_docs_db-0.1.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for po_docs_db-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a6ec1925562caf0568dbffc8d244fb0fe48a09f62d2413047a26ca272907187f
MD5 b6c4c34d32d0153090eb07f88aa06d0a
BLAKE2b-256 3509ee198b841f01761a0d3f06fdd01eec927c4b1ed665bb892ccdfef1604871

See more details on using hashes here.

Provenance

The following attestation bundles were made for po_docs_db-0.1.0.tar.gz:

Publisher: po-docs-release.yml on a327730684/yo-iterative-review

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file po_docs_db-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: po_docs_db-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for po_docs_db-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e26b06758364da5d8df99b874ee8ee3c7356c7f21781c828b8ac021e9aa87f1
MD5 ed19fe1c777f9b08c22f4a89e373eca4
BLAKE2b-256 121a7f23c07edda963c228b1de7e1b52c9b7ac4dd2c6d54faef77128308d91b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for po_docs_db-0.1.0-py3-none-any.whl:

Publisher: po-docs-release.yml on a327730684/yo-iterative-review

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page