Files
DeepTutor/deeptutor/learning/tests
Benjamin Schwing 50059901b5 fix(learning): grade numeric answers deterministically
Short answers were fuzzy-matched with SequenceMatcher >= 0.85, so
"1250.60" passed for "1250.50", "-200" for "200" and "x=3, y=4" for
"x=3, y=5", while "1.250,50", "1250,50 €" and "1/8" were rejected for
"1250.50" / "0.125". Mastery's exact_verdict only compared casefolded
strings and left every number to an LLM verdict.

Add numeric_equivalent() to learning/grading.py: locale-aware decimal
and grouping separators with an explicit ambiguity rule, sign, currency,
percent, unit, fraction and scientific notation parsing, tolerance from
the key's written precision, and labelled/positional multi-part
comparison. grade_answer never fuzzy-matches a numeric key, and
exact_verdict returns a final verdict for numeric matches and for
unambiguous numeric mismatches on short questions.

Test vectors live in tests/fixtures/numeric_answers.json so the web port
can share them.

Signed-off-by: Benjamin Schwing <63053132+BenjiAvH@users.noreply.github.com>
2026-11-24 18:27:48 +00:00
..
2026-09-06 13:46:29 +08:00
2026-09-03 01:38:54 +08:00
2026-11-16 02:17:36 +08:00
2026-09-06 13:46:29 +08:00