太玄语义转译基座(Taixuan Semantic Base)
把中文语义编码为三态符号、按固定裁决表耦合判定的可复用底座,附 MCP 服务壳。纯标准库,Python >= 3.10。
这套东西是什么
太玄语义转译把一个语义块拆成若干语义元,每个语义元取三态之一:
- 0 阴(敛)——收敛、归藏、未显
- 1 中(枢)——转化门、枢纽、中和之域
- 2 阳(发)——显发、外向、生发
块内语义元按耦合裁决表逐步耦合,得到块的最终态与闭合判定(归/悬)。
九条法则(规则层定稿)
- 三态基底:0 阴、1 中、2 阳;1 为转化门,非插值。
- 义先于符:绑定义项,不绑字形。
- 互化铁律:0↔2 必经 1;无枢则不化。
- 耦合裁决表:同态相叠(0+0→0、2+2→2、1+1→1);对冲 0+2→1;有枢参与 1+0→0*、1+2→2*;表外入悬枢 1*。
- 结合顺序:枢优先结合——块内有枢先结算枢与枢,再由总枢与其余义元从左到右耦合;无枢从左到右;带 * 结果态按原态参与、按带枢记档。
- 拆分粒度:最小独立义元优先;复合义元可整体赋态或拆元耦合,两路必须同归,不一致整元入悬枢待上下文锁定。
- 弱辅态收紧:仅当主态耦合无法按裁决表闭合时才许引入,且须在枢标记中记档;禁止以弱辅态改写主态。
- 层级嵌套:取象同构,不作判据。
- 耗散对应:仅意涵层叙事,不作验证依据。
五大转译模式(模式层)
由经典文本试编码高频归纳:
- 敛算子:「不X/无X」句式=标准敛算子,显态收敛归藏。
- 对冲共存枢象:「X而不Y」=对冲共存,经枢而立。
- 显发自耗:「物壮则老」=2→0 显发自耗律。
- 溯源归藏:「先于X/万物之宗」=0→2 溯源归藏模式。
- 以敛得枢:「受国之垢/后其身」=以敛得枢 0→1。
快速开始
from taixuan_semantic import Element, encode_block, verify_corpus
# 道德经首章块1:道可道,非常道
result = encode_block([
Element("道体", 1), # 枢
Element("可道", 2), # 阳
Element("非常道", 0), # 阴
])
print(result.serialize()) # 1(归)
print(result.trace) # 耦合过程
# 跑回归语料(道德经首章八块)
report = verify_corpus()
print(f"闭合:{report['passed']}/{report['total']}")
MCP 服务壳(STDIO)
在任意 MCP 客户端(Claude Desktop、Cursor 等)配置:
{
"mcpServers": {
"taixuan-semantic-base": {
"command": "python3",
"args": ["/full/path/to/taixuan-semantic-base/taixuan_semantic/server.py"],
"env": {"PYTHONPATH": "/full/path/to/taixuan-semantic-base"}
}
}
}
五个工具:
| 工具 | 说明 |
|---|---|
base_rules |
返回九条转译法则 |
couple |
两态耦合判定 |
encode_block |
语义元列表 → 块编码与闭合判定 |
patterns |
五大模式说明(可传句子做词法识别) |
verify_corpus |
跑回归语料报告闭合率 |
回归语料
回归基准来自《道德经》首章逐块试编码(八块)与明枢锚 27 处清单。 期望结果以试编码文档实测为准:块1→1归、块2→1归、块3→0归、块4→2归、 块5→0归、块6→2*归、块7→1归、块8→1归。
运行测试
python3 tests/test_base.py
覆盖:裁决表 3×3 全路径、互化铁律、枢优先结合顺序、悬枢路径、 非法输入、道德经首章八块回归、明枢锚清单、语料验证一致性。
许可证
MIT — 见 LICENSE。
Metadata
Release files for taixuan-semantic-base 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| taixuan_semantic_base-0.1.0.tar.gz | 14.8 kB | Without provenance | Details for taixuan_semantic_base-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| taixuan_semantic_base-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for taixuan_semantic_base-0.1.0-py3-none-any.whl |
Total release size: 30.4 kB
Release files / taixuan_semantic_base-0.1.0.tar.gz
| Download URL | taixuan_semantic_base-0.1.0.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3893f23e858b10b0f84cefb4ce38761d78fe018779f58a7358f04d7fee054300
|
|
BLAKE2b-256 checksum How to use checksums |
3d05b2244bd86b2d0944c673a9113ae67b7dae2a3cc1c62eab83a03c55af8f30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / taixuan_semantic_base-0.1.0-py3-none-any.whl
| Download URL | taixuan_semantic_base-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f28dc750da085e035a1dee8ef031744488b9ac10e9e025fa737dc447717fda7
|
|
BLAKE2b-256 checksum How to use checksums |
82b45a043e259cdbed0e90f385718e47b6f456e5a9a65d3ead60dff309466f47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for taixuan-semantic-base 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.