fix(routing): route the vocabulary beginners actually use - #120
Open
xr843 wants to merge 1 commit into
Open
Conversation
PR #119 shipped an executable router but scored only off meta.json search_scope.keywords, which are doctrinal retrieval terms. Running the README 「你的状况」 table through it exposed the gap: 4 of its 11 rows resolved to the default pairing, including the first one. 妄念纷飞坐不住 → kumarajiva, yinguang (should be xuyun/zhiyi/ajahn-chah) 读经文看不懂逻辑 → kumarajiva, yinguang (should be xuanzang) 学佛很久但无力感 → kumarajiva, yinguang (should be yinguang) 想学最朴素的禅修 → kumarajiva, yinguang (should be ajahn-chah) A beginner does not type 四念处, they type 坐不住 — and the people most in need of routing are exactly the ones without the vocabulary. Adds routing.json.situations between the keyword and topic-pairing layers. It holds only those four rows: the other seven README rows already route correctly off persona keywords and are deliberately not duplicated, so this layer stays the exception rather than a second copy of the table. Layer order is now mode_rules → persona_keywords → situations → topic_pairings → default_pairing. An explicit doctrinal term outranks a felt-state phrase ("念佛的时候妄念很多" routes on 念佛), and situations sit ahead of topic_pairings because that table was authored to pair masters for /compare-masters, not to answer "who should I ask?". Also adds 空性 to master-nagarjuna, master-kumarajiva and master-tsongkhapa. It is the ordinary modern rendering of śūnyatā, but all three declared only 性空 / 缘起性空, so "想了解空性" surfaced Milarepa alone — the two Madhyamaka masters were missing their own central term. This adds a word order already inside each master's declared scope, not a new doctrinal claim. validate-routing.py gains two checks: situations keyword sets must be pairwise disjoint, and a situation keyword may not collide with a mode_rules keyword — mode routing short-circuits first, so such a row would be silently unreachable. Both verified against deliberately broken data. The eleven README rows are now regression fixtures, the same contract the teaching-modes examples carry: editing the table without updating the routing data fails the suite. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KdbEMEsHB9n2eDspNuN54j
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
接续 #119。那个 PR 让路由可执行了,但打分只认
meta.json的search_scope.keywords——而那是教理检索词表。实测暴露的问题
把 README 「你的状况」表 11 行全跑一遍,4 行落到默认配对,包括第一行:
新手不会打「四念处」,他会打「坐不住」。而最需要被路由的,恰恰是没有术语的人。
方案
新增
routing.json.situations,插在关键词层与主题配对层之间。**只装那 4 行。**另外 7 行 persona keywords 本来就接得住,刻意不复制——这一层是例外,不是状况表的第二份拷贝。
层级顺序变为:
念佛的时候妄念很多走念佛,不走妄念/compare-masters配对而写的,不是为回答「我该问谁」另修:
空性master-nagarjuna/master-kumarajiva/master-tsongkhapa三位都只声明了性空/缘起性空,没有空性——而这是现代人表达 śūnyatā 最常用的语序。结果想了解空性只推出米拉日巴,两位中观祖师漏了自己的核心词。现在给出印度 / 汉传 / 藏传三个传统。
门禁
validate-routing.py新增两项:situations关键词集两两不相交mode_rules撞 —— 模式层先短路,撞了该行永远不可达(静默死代码)两项都用故意写坏的数据反测过,确认能抓到。
防漂移
README 那 11 行现在是回归 fixture,与
teaching-modes.md十条同样的契约:改表不改路由数据,测试就挂。验证
72 条 CLI 测试(+12),完整 CI 等价套件 16 项全绿,含
pytest 369 passed。🤖 Generated with Claude Code
https://claude.ai/code/session_01KdbEMEsHB9n2eDspNuN54j