diff --git a/deeptutor/learning/semantic_assessment.py b/deeptutor/learning/semantic_assessment.py index f5611b1a1..a9619e02e 100644 --- a/deeptutor/learning/semantic_assessment.py +++ b/deeptutor/learning/semantic_assessment.py @@ -118,7 +118,8 @@ def exact_verdict(question, answer): # ambiguous reading may still be right, and multi-part answers may earn # partial credit, so all of those stay semantic. first = numeric[0] - if question.question_type == "short" and len(first.parts) == 1 and not first.ambiguous: + settled = len(first.parts) == 1 and not any(n.ambiguous for n in numeric) + if question.question_type == "short" and settled: return Verdict( result="incorrect", confidence=1, diff --git a/deeptutor/learning/tests/test_grading.py b/deeptutor/learning/tests/test_grading.py index f86c4733e..cfa0213cc 100644 --- a/deeptutor/learning/tests/test_grading.py +++ b/deeptutor/learning/tests/test_grading.py @@ -391,6 +391,10 @@ class TestExactVerdictNumeric: assert self._verdict(answer, expected) is None assert self._verdict("1.251.000", "1.250").result == "incorrect" + def test_ambiguous_accepted_answer_keeps_the_mismatch_open(self): + assert self._verdict("416,67", "417,00", accepted=["≈ 417"]) is None + assert self._verdict("415,20", "417,00", accepted=["≈ 417"]).result == "incorrect" + def test_multi_part_mismatch_keeps_partial_credit_open(self): assert self._verdict("a) 1.000; b) 260", "a) 1.000; b) 250") is None assert self._verdict("1250", "Goodwill = 1.250; NCI = 300") is None