tc_medical_base — 中醫典籍檢索語料
Clause-level (條文) corpus of five classical TCM texts with precomputed sentence-BERT embeddings, built for the 典籍提示 (classical-text hint) retrieval feature of the tcm-homevisit 中醫居家醫療 app (Taiwan).
Books (retrieval units after parsing)
| 書名 | clauses |
|---|---|
| 傷寒論(宋本) | 603 |
| 傷寒雜病論(桂林古本) | 995 |
| 金匱玉函經 | 1,215 |
| 金匱要略方論 | 590 |
| 傅青主女科 | 166 |
| total | 3,569 |
(古本康平傷寒論 was included in an earlier revision and removed 2026-08: its clauses overlap heavily with 宋本/桂林古本 with divergent wording, so the same 條文 crowded the top-k in three versions.)
Counts are retrieval units: one record per 條文/paragraph, with 方劑
(name + 組成 + 煎服法, the h-formula blocks) attached to the preceding
clause's formula field rather than standing alone; front matter (序/凡例)
excluded; paragraphs longer than 400 chars (傅青主女科) chunked at sentence
boundaries. They therefore differ from the editions' nominal 條數.
Files
corpus/tcm_classics.jsonl— one record per clause:{id, book, chapter, section, clause_no, text, text_embed, formula}.textkeeps the original glyphs as published;text_embedhas 異體字/古字 normalized (𤼵→發, 㣲→微, 隂→陰, …) and whitespace stripped — embed and search againsttext_embed, displaytext.corpus/embeddings.npy— float32(3569, 512), L2-normalized, row i ↔ jsonl line i. Model: BAAI/bge-small-zh-v1.5, passages encoded without instruction prefix. Queries must be encoded with the prefix為這個句子生成表示以用於檢索相關文章:then scored by dot product.raw/*.html— cached source HTML for reproducibility.scripts/build_corpus.py,scripts/build_embeddings.py— full rebuild:
pip install -r requirements.txt
python scripts/build_corpus.py # fetch + parse → corpus/tcm_classics.jsonl
python scripts/build_embeddings.py # encode → corpus/embeddings.npy
Source & attribution
Text source: 中醫笈成 (jicheng.tw), data repository gitlab.com/jicheng/jc.data. The classical texts themselves are in the public domain; the punctuated and collated digital editions are the work of 中醫笈成 — please keep this attribution when reusing.
Intended use
Advisory retrieval hints (僅供參考) for licensed TCM practitioners; not a diagnostic or prescribing system.
- Downloads last month
- 11