fix(hldp): rank Chinese causal branch queries

This commit is contained in:
冰朔 2026-08-15 15:18:10 +08:00
commit fb1096c5ec
2 changed files with 18 additions and 1 deletions

View file

@ -48,6 +48,12 @@ test("route returns paths and summaries only, capped at three", () => {
assert(!JSON.stringify(candidates).includes("A失败"));
});
test("route ranks a matching Chinese branch instead of treating a sentence as one token", () => {
const candidates = route(validTree(), "为什么最终方案发生变化", 3);
assert.equal(candidates[0].path, "root/decision");
assert(candidates[0].score > 0);
});
test("read-node reads exactly one bounded node", () => {
const node = readNode(validTree(), "root/decision");
assert.equal(node.path, "root/decision");