Repository navigation
fix(officeqa): match a Unicode minus sign to its ASCII form - #485
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Lanre Shittu (Shizoqua) wants to merge 1 commit into
Conversation
PDF-extracted tables often write a negative number with U+2212 (the minus sign) instead of the hyphen-minus. normalize_answer kept the U+2212 character, so "−5.2" and the gold "-5.2" normalized differently and a correct answer scored 0 on EM and F1. Replace U+2212 with "-" before the other normalization steps. Different signs still do not match.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
normalize_answerinskillopt/envs/officeqa/evaluator.pykept the Unicode minus sign (U+2212) as a separate character. PDF text extraction often writes negative values this way, so−5.2and the gold-5.2normalized to different strings and a correct answer scored 0 on EM and F1. This change maps U+2212 to-before the other normalization steps.Changes
skillopt/envs/officeqa/evaluator.py:normalize_answerreplaces U+2212 with-before the comma and punctuation steps. Nothing else changes, and different signs still do not match.tests/test_officeqa_unicode_minus.py: new tests (see below).CHANGELOG.md: entry under Fixed.Tests
−5.2against5.2,5.2against−5.2,−5against-6). These pass on main and with this change.ruff check: the only warning on the changed file is the import-sort note (I001) that already exists on main. The new test file passesruff format --check.Fixes #484