Skip to content

Fix baseline parsing of long dates merged with the code; re-measure Gate 1 - #4

Merged
CodeAvk merged 1 commit into
mainfrom
fix/baseline-long-dates
Nov 28, 2026
Merged

CodeAvk merged 1 commit into
mainfrom
fix/baseline-long-dates

Conversation

@CodeAvk

@CodeAvk CodeAvk commented Nov 28, 2026

Copy link
Copy Markdown
Owner

Fixes #3

What changed

  • backend/app/baseline.py: after a date is found, the code is matched right after it with only a right boundary, so OCR text such as Apr 28, 2026G5213 is parsed. Long dates with no space after the comma are accepted and printed as Mar 5, 2026. The old whole-row code search stays as a fallback.
  • Two new tests: merged date and code rows (four taken from real OCR output on the synthetic hard set), and a row where OCR misread SYN as 6YN, which is still skipped rather than guessed.
  • Re-ran both baselines on the hard set and the plain baseline on the easy set, and updated docs/GATE1_RESULTS.md, the README and PLAN.md.

Result (same 31 hard cases)

Extractor Line F1 Flags exact False alarms (clean)
Deskew baseline, before 0.904 74% 4/8
Deskew baseline, after 0.985 94% 1/8
Gemini 2.5 Flash 0.961 100% 0/8

The baseline now reads line items slightly better than Gemini, so the docs no longer say AI clearly wins. Gemini's remaining edge is 2 of 31 cases on flags.

Checks

  • python -m pytest -q: 45 passed.
  • Easy set (plain baseline, 32 cases): unchanged at line F1 1.000, all flags right, 0/8 false alarms.
  • No dependency changes. No secrets in the diff. CI runs the dependency audits and gitleaks on this PR.

…ate 1

OCR often returns a long date and the code next to it as one piece of
text ("Apr 28, 2026G5213") or drops the space after the comma
("Mar 5,2026"), so the baseline skipped those bill lines. The code is now
matched right after the date with only a right boundary, and long dates
are printed in the standard form.

Re-ran both baselines on the hard set and the plain baseline on the easy
set. On the same 31 hard cases the deskew baseline now scores line F1
0.985 against 0.961 for Gemini, so the results, README and plan no longer
say AI clearly beats the baseline.
@CodeAvk
CodeAvk merged commit 8488be0 into main Nov 28, 2026
3 checks passed
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.

Baseline misses bill lines when OCR merges a long date with the code

1 participant