Skip to main content
Glama
io.github.tanbopiao/taixuan-semantic-base

io.github.tanbopiao/taixuan-semantic-base

by tanbopiao

太玄语义转译基座(Taixuan Semantic Base)

把中文语义编码为三态符号、按固定裁决表耦合判定的可复用底座,附 MCP 服务壳。纯标准库,Python >= 3.10。

这套东西是什么

太玄语义转译把一个语义块拆成若干语义元,每个语义元取三态之一:

  • 0 阴(敛)——收敛、归藏、未显

  • 1 中(枢)——转化门、枢纽、中和之域

  • 2 阳(发)——显发、外向、生发

块内语义元按耦合裁决表逐步耦合,得到块的最终态与闭合判定(归/悬)。

Related MCP server: Turnproof

九条法则(规则层定稿)

  1. 三态基底:0 阴、1 中、2 阳;1 为转化门,非插值。

  2. 义先于符:绑定义项,不绑字形。

  3. 互化铁律:0↔2 必经 1;无枢则不化。

  4. 耦合裁决表:同态相叠(0+0→0、2+2→2、1+1→1);对冲 0+2→1;有枢参与 1+0→0*、1+2→2*;表外入悬枢 1*。

  5. 结合顺序:枢优先结合——块内有枢先结算枢与枢,再由总枢与其余义元从左到右耦合;无枢从左到右;带 * 结果态按原态参与、按带枢记档。

  6. 拆分粒度:最小独立义元优先;复合义元可整体赋态或拆元耦合,两路必须同归,不一致整元入悬枢待上下文锁定。

  7. 弱辅态收紧:仅当主态耦合无法按裁决表闭合时才许引入,且须在枢标记中记档;禁止以弱辅态改写主态。

  8. 层级嵌套:取象同构,不作判据。

  9. 耗散对应:仅意涵层叙事,不作验证依据。

五大转译模式(模式层)

由经典文本试编码高频归纳:

  1. 敛算子:「不X/无X」句式=标准敛算子,显态收敛归藏。

  2. 对冲共存枢象:「X而不Y」=对冲共存,经枢而立。

  3. 显发自耗:「物壮则老」=2→0 显发自耗律。

  4. 溯源归藏:「先于X/万物之宗」=0→2 溯源归藏模式。

  5. 以敛得枢:「受国之垢/后其身」=以敛得枢 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。

Available Tools

5 tools
base_rulesB

返回九条转译法则(基座规则层定稿)

Inputs: no named parameters.

coupleB

两态耦合判定:给定两个语义元的态(0/1/2),按裁决表返回结果态与规则说明

Inputs: left (required), right (required).

encode_blockC

语义元列表 → 块编码与闭合判定(枢优先结合顺序)

Inputs: elements (required).

patternsC

五大转译模式说明;可传入句子做词法层提示识别

Inputs: sentence.

verify_corpusC

跑回归语料(道德经首章八块),报告闭合率

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 5 tools

    Disambiguation3/5

    The five tools are mostly distinguishable (a coupler, an encoder, a corpus runner, plus two documentation-style tools), but base_rules and patterns both read as 'return rule/pattern reference text' and an agent may not know which to call first. couple and encode_block also sit on a hierarchy (couple is a primitive of encode_block), making it unclear when the pairwise tool should be used directly.

    Naming Consistency3/5

    All names are snake_case, but the conventions are mixed: base_rules and patterns are bare nouns, encode_block and verify_corpus are verb_noun, and couple is a bare verb. There is no predictable pattern an agent can infer for guessing new or existing tool names.

    Tool Count4/5

    Five tools is a compact, well-scoped surface for a narrow deterministic rule system, and each tool has a distinct role. It is on the thin side, but nothing feels padded or redundant.

    Completeness3/5

    The surface covers rules, patterns, the coupling primitive, block encoding with closure, and regression verification, which is a reasonable core. However, there is no inverse/decode operation for encode_block and no tool to inspect or resolve individual semantic units and their states, leaving an obvious dead end for round-trip workflows.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables users to trace regulatory rule changes to affected parties and required actions through deterministic safety gates, returning dated action plans and hash-linked evidence records. Supports 12 MCP tools over stdio or streamable HTTP for source comparison, obligation decomposition, scope assessment, planning, and evidence validation across multiple domain packs.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables Alexa+ conversational applications to compile conversational contracts into revisioned state rules, guard effects against stale or ambiguous state, and generate adversarial multi-turn attacks through MCP tools.
      Apache 2.0
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP clients to perform dialectical reasoning through thesis, antithesis, and synthesis, and to run player-coach autocoding loops with independent verification for code implementations.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables MCP-compatible editors and agents to run dialectical reasoning and player-coach autocoding workflows, producing thesis-antithesis-synthesis analysis and independently verified code implementations.
      -