fix(skill-find): 停用词按词切('怎么' 曾被切成单字导致误命中)+ 弱匹配阈值 12 与降级阶梯
- QSTOP 原为 set(字符串)=单字集合,'怎么/如何' 等双字疑问词不在其中 → 「量子计算机怎么修」误命中 FRP 技能。改为 单字集 ∪ 显式双字疑问词表。 - 最高分 < 12 时提示『没有强匹配』并给三级阶梯(搜现成→装→自建), 而不是硬塞一个低分候选。 - 回归:6 个正例仍 6/6 命中正确技能(obsidian/密钥清历史/vault整理/看板/验收/2B下沉)
This commit is contained in:
parent
03e8a1d7d7
commit
66132bd4e6
|
|
@ -13,7 +13,11 @@
|
|||
import os, re, sys, glob
|
||||
|
||||
SKILLS = os.path.expanduser("~/.hermes/skills")
|
||||
QSTOP = set("的了和与及怎么如何要要不要是否有我你他她它把被给对为在从到就都也很呢吗个这那注意事项问题办法方法请问帮我一下做个")
|
||||
QSTOP = set("的了和与及是否我你他她它把被给对为在从到就都也很呢吗个这那") | {
|
||||
"怎么", "如何", "什么", "为什么", "哪些", "多少", "可以", "需要", "我们",
|
||||
"这个", "那个", "问题", "方法", "办法", "一下", "帮我", "请问", "注意",
|
||||
"事项", "一个", "做个", "要做", "不要", "有没有", "是不是",
|
||||
}
|
||||
|
||||
|
||||
def load_skills():
|
||||
|
|
@ -87,9 +91,11 @@ def main():
|
|||
if sc:
|
||||
scored.append((sc, s, why))
|
||||
scored.sort(key=lambda x: -x[0])
|
||||
if not scored:
|
||||
print(f"❌ 技能库无匹配:「{q}」")
|
||||
print(" → 下一步:web_search 找现成技能库 → 装(skill-library-porting);都没有 → 按方法论自建(hermes-self-improvement)")
|
||||
if not scored or scored[0][0] < 12:
|
||||
print(f"⚠️ 没有强匹配:「{q}」(最高分 {scored[0][0] if scored else 0} < 12,下列仅为弱相关)")
|
||||
print(" 阶梯:web_search 找现成技能库 → 装(skill-library-porting)→ 都没有 → 按 hermes-self-improvement 自建\n")
|
||||
for sc, s, _ in scored[:3]:
|
||||
print(f" [{sc:>3}] {s['name']} — {s['desc'][:80]}")
|
||||
return
|
||||
print(f"🔍 「{q}」→ {len(scored)} 个候选,取前 {min(top,len(scored))}:\n")
|
||||
for sc, s, why in scored[:top]:
|
||||
|
|
|
|||
Loading…
Reference in New Issue