Stage 18 instrument fix: LF corpus normalization helper, gold oracle, D2 union-merge

↗ view on GitHub · Eli Ziff · 2026-07-31 · 1b115b36

The 17 maud corpus files are CRLF(+BOM); upstream gold spans are LF
coordinates (decidable from the shipped `answer` string). Adds
normalizeCorpusText (CRLF->LF, BOM kept - gold counts the BOM: 334/334
maud snippets slice correctly with it, 0/334 without) plus the source-db
path constants that keep the normalized and raw builds in separate
coordinate spaces.

legalbench-gold-oracle-check.ts asserts text[start:end]==answer for every
snippet of every source; 1362/1362 pass normalized, 334 maud fail --raw.

D2: charPrecisionRecall summed every pairwise retrieved x gold overlap, so
overlapping chunks/pool spans credited the same gold characters more than
once and recall could exceed 1.0. Credited intersections are now
union-merged per document and both ratios clipped at 1.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H9ToHYJVDxfeJcJwdzrP2H
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents 13359499
Stats 3 files changed , +257 , -6
Part of Legal grounding and retrieval research

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-1b115b36.md from inside the repo you want the change in.

⬇ Download capture-commit-1b115b36.md