Skip to content

fix(scoring): fold Unicode minus U+2212 so negative answers grade by value - #468

Open
marktech0813 wants to merge 3 commits into
James-CUDA:mainfrom
marktech0813:fix/460-unicode-minus
Open

fix(scoring): fold Unicode minus U+2212 so negative answers grade by value#468
marktech0813 wants to merge 3 commits into
James-CUDA:mainfrom
marktech0813:fix/460-unicode-minus

Conversation

@marktech0813

Copy link
Copy Markdown
Contributor

Summary

Models echoing rendered math emit Unicode minus (U+2212). `extract_last_number` and `normalize_math_answer` only knew ASCII `-`, so unboxed `−3` graded as `3` (sign-flip false positive) and boxed `\boxed{−3}` failed to match `-3`.

Fold U+2212 → ASCII hyphen in both paths (same glyph-fold pattern as π→pi). En/em dashes are not folded.

Closes #460

Test plan

  • Regression tests for extract / normalize / `score_text('math500', ...)`

Made with Cursor

…value

Rendered math emits U+2212; without folding, unboxed answers lose their
sign and boxed answers fail exact/numeric match against ASCII gold.

Closes James-CUDA#460
ruff 0.16.0 enables rules that fail 312 times across src/ on current
main, so every PR inherits a red lint job unrelated to its diff.
main CI fails tests/test_drop_leading_decimal_point.py on $.5 / .5.
forms that lose the leading point on the second-chance strip path.
Exclude "." from _STRIP_EDGE and retry with rstrip(".") so every PR
can validate its own fix (same unblock as James-CUDA#450/James-CUDA#462).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] MATH grader: Unicode minus U+2212 is invisible — "−3" extracts as unsigned "3" (sign-flip false positive) and \boxed{−3} never matches -3

1 participant