Update generate/derivation/verify.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
04e70dabfa
commit
74fbc6090e
1 changed files with 3 additions and 4 deletions
|
|
@ -87,12 +87,11 @@ def self_verifies(derivation: GroundedDerivation, problem_text: str) -> SelfVeri
|
||||||
# microscope identified (ADR-0175 self-verification strengthening): it
|
# microscope identified (ADR-0175 self-verification strengthening): it
|
||||||
# catches the multi-step-incomplete attempts the cue/grounding clauses
|
# catches the multi-step-incomplete attempts the cue/grounding clauses
|
||||||
# cannot, because their operands ARE grounded.
|
# cannot, because their operands ARE grounded.
|
||||||
problem_quantities = {q.source_token for q in extract_quantities(problem_text)}
|
problem_quantities = Counter(q.source_token for q in extract_quantities(problem_text))
|
||||||
used = {derivation.start.source_token}
|
used = Counter([derivation.start.source_token] + [step.operand.source_token for step in derivation.steps])
|
||||||
used.update(step.operand.source_token for step in derivation.steps)
|
|
||||||
unused = problem_quantities - used
|
unused = problem_quantities - used
|
||||||
if unused:
|
if unused:
|
||||||
reasons.append(f"incomplete: unused problem quantities {sorted(unused)}")
|
reasons.append(f"incomplete: unused problem quantities {sorted(unused.keys())}")
|
||||||
|
|
||||||
return SelfVerification(verified=not reasons, reasons=tuple(reasons))
|
return SelfVerification(verified=not reasons, reasons=tuple(reasons))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue