mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-06 20:28:58 +08:00
fix(learning): leave multi-part numeric mismatches to the judge
A deterministic "incorrect" for "a) 1.000; b) 260" against "a) 1.000; b) 250", or for an answer that omits a part, removed the partial credit the semantic judge can award per subtask. Only a single short number now gets a final numeric "incorrect"; every other mismatch falls through to the existing judge. Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
This commit is contained in:
@@ -114,9 +114,11 @@ def exact_verdict(question, answer):
|
||||
confidence=1,
|
||||
feedback=question.explanation or "Matches the stored answer.",
|
||||
)
|
||||
# Only a short answer is the bare number itself; open answers may explain
|
||||
# one, and an ambiguous separator has two readings, so both stay semantic.
|
||||
if question.question_type == "short" and numeric[0].comparable and not numeric[0].ambiguous:
|
||||
# Only a single short number is final: open answers may explain one, an
|
||||
# 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:
|
||||
return Verdict(
|
||||
result="incorrect",
|
||||
confidence=1,
|
||||
|
||||
@@ -333,3 +333,8 @@ class TestExactVerdictNumeric:
|
||||
assert self._verdict("125000", "125.000") is None
|
||||
assert self._verdict("about 1250", "1250.50") is None
|
||||
assert self._verdict("1300", "1250.50", accepted=["ca. 1300"]).result == "correct"
|
||||
|
||||
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
|
||||
assert self._verdict("a) 1.000; b) 250", "a) 1.000; b) 250").result == "correct"
|
||||
|
||||
Reference in New Issue
Block a user