Files
playbook/skills/tsl-syntax-reference/data
csh 40a9885eb4 feat(tsl-syntax-reference): harden retrieval and restructure pages
- flag weak candidates (no intent/heading/identifier/tag hit) and exit 2
  when every candidate is weak: mis-hits used to be indistinguishable
  from real hits, so the retry-with-better-terms loop never fired
- accept multiple ids per --section for batch fetch, failing atomically
  on any unknown id so a partial fetch cannot pass as complete
- move query synonyms and page intent aliases to data/lexicon.json and
  enforce alias/page correspondence in --check; curation data no longer
  lives in the engine
- document the weak-hit rule, batch fetch and prelude-once guidance in
  SKILL.md, with curation discipline in data/README.md
- drop 11_pitfalls.md, renumber the trailing pages and spread retrieval
  tags across topics; lexicon keys are page filenames, so the renumbering
  and the new --check rule cannot land in separate commits
2026-07-29 15:45:47 +08:00
..

检索词表(lexicon.json

lexicon.jsonscripts/lookup.py 的策展检索数据,与引擎逻辑分离维护。 两张表都只影响检索,不是事实正文。

query_synonyms —— 口语同义词

中文口语词 → TSL 术语的展开(如「打印」→ 输出 / writeLn)。策展纪律:

  • 同义词必须落在目标章节已有的词面上,否则不产生区分度。用户说的词在 参考页正文里出现 0 次时,页级 alias 只能把整页抬起来,页内仍需要词法 信号才能选中正确章节——节级词汇桥(如「交集」→ intersect)补的就是 这一层。
  • 不要展开成泛化的中文概念词(如「集合运算」会命中别页交叉引用小节标题)。

page_intent_aliases —— 页级意图短语

整句口语短语 → 参考页文件名的路由(命中一条 +80 分,是页级路由的唯一强 信号)。约束:

  • 键必须与 references/ 下的文件名完全一致;每个参考页至少一条短语。 键写错或参考页改名后 _intent_score 会静默返回 0 分,该页失去自然语言 入口——lookup.py --check 和回归测试会拦住这两种漂移。

改动后的校验

python scripts/lookup.py --check
python -m unittest test.test_tsl_syntax_lookup_recall   # 在仓库根目录运行

新增参考页时,除补词表外还须在回归测试里补一条真实问法 (test/test_tsl_syntax_lookup_recall.pyRECALL_CASES)。