H and K tested (G0168, G0178 accepted); keyword fast path needs all groups

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
Kral
2026-10-03 06:04:36 +02:00
parent f907351c0d
commit a12fa4dff6
14 changed files with 747 additions and 5 deletions

View File

@@ -1,8 +1,9 @@
"""Stop tasks (category H): did the model name the right gap?
1. Keywords: task.json "expected_gap": {"description": "...", "keywords": [["discount", "rate"], ...]}.
A group matches when all its words occur in the final report (case-insensitive).
2. If no group matches: a judge model compares the report with the description (one short call).
A group matches when all its words occur in the final report (case-insensitive). Fast path only
when all groups match.
2. Otherwise: a judge model compares the report with the description (one short call).
"""
import json
import os
@@ -27,10 +28,11 @@ only other, unrelated points does not name it. Answer with one JSON object and n
def keyword_hit(report, groups):
"""All groups must match. One group alone is too loose (G0168: "volume discount" also occurs in a
report that stops for another reason)."""
text = (report or "").lower()
for g in groups or []:
if all(re.search(rf"\b{re.escape(w.lower())}", text) for w in g):
return g
if groups and all(all(re.search(rf"\b{re.escape(w.lower())}", text) for w in g) for g in groups):
return groups
return None