Skip to content

Accuracy push: text, statistics, tables and links before the JATS v2 holdout - #304

Open
thesanogoeffect wants to merge 21 commits into
mainfrom
claude/project-thread-lpgjla
Open

thesanogoeffect wants to merge 21 commits into
mainfrom
claude/project-thread-lpgjla

Conversation

@thesanogoeffect

@thesanogoeffect thesanogoeffect commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Accuracy push before the JATS v2 holdout run. This branch fixes the failures we found when we ran bibr on every paper we had except the holdout: JATS v1 keyed, about 2,000 PMC papers, and the bes/ecology/psychsci pools checked against the PDF text layer.

The order follows Metacheck's priorities: body text, then links, then statistics.

Changes

Text

  • f65e032: a text-layer formula region that is mostly words is read as a paragraph, not [equation].
  • 9c19c9e: an OCR formula region that reads as prose is read as a paragraph too.
  • bf04ef5: a short results line boxed as a display formula (for example t(111) = 2.3, p = .02) is read as text.
  • f7bc1a9: statements, footnotes and epigraphs that the layout model boxed as page header or footer are kept.

Statistics

  • 870f3ff: an unmapped minus glyph is read as a minus sign. This is the same fix as Keep minus signs that Cambridge fonts draw with unmapped glyphs #301; it is included here so the branch scores as one build.
  • 2835f70: the square in a scanned χ², η² or ω² is kept out of the citation-marker cleanup.
  • 48b51a5: OCR inline maths is read as printed text.
  • 62ec7db: a doubled script group (^{{***}}) is flattened.

Tables

  • cdc2b86: LaTeX in table cells is flattened to printed text.
  • 9c813b8: a literal \n in a cell reads as a space.
  • f2e8cc6, ced3867, 9c813b8: a digit the OCR model misread in a table is corrected from the page's text layer. This only happens when the two numbers are paired one to one, are one digit apart, and the counts agree. Numbers in LaTeX maths and digits inside words are never changed.
  • 24ca291: a table the OCR model cut off at its token limit is rebuilt from the text layer, when the rebuild has more words.

Links

  • b2257d0: citation numbers glued after a link's closing bracket are dropped, and a host that a line wrap cut after a dot is joined back together.

Validation

Keyed JATS v1, 48b51a5 vs the 0.9.3 + minus-fix baseline (all papers, declan):

Set Metric Baseline 48b51a5
Scans Stats 0.9498 0.9970
Born-digital Links 0.9683 0.9709

There were no real regressions.

Keyed JATS v1 on 62ec7db (zbook): a stratified sample of 117 papers, plus 201 papers in all, run with regress1 against the baseline and 48b51a5.

  • Total regressions: 0 at every checkpoint. No paper got worse by more than 1 point.
  • Tables: +2.7 to +3.0 on born-digital papers and +6.35 on scans.
  • One caveat: on zbook the LLM ran on the CPU with the Q8_0 GGUF, so the equation fallback timed out. That run doesn't measure equations.

Self-check against the text layer (selfcheck v3.1): text kept 97.2–97.9% across the PMC, bes, ecology and psychsci pools. f2e8cc6 found 7 more PMC links than the build before it, with no link newly missed. The digit correction changed 45 numbers in 14 PMC papers, and none of the changes turned a correct number wrong.

Tests: unit tests were added for each fix. The full suite passes, except one existing test_setup_wizard failure, which needs torch.

The JATS v2 holdout was not run, scored or looked at.


Generated by Claude Code

thesanogoeffect and others added 14 commits November 30, 2026 14:11
Cambridge's fonts (Psychological Medicine) draw the minus sign with a glyph
they leave unmapped, so pdfium reports it as a control character (U+0001 or
U+0003). bibr stripped it or sent the region to OCR, and negative statistics
lost their sign: of the 98 negative statistics in 18 such papers of the JATS
text benchmark, 0.9.3 kept 44 and --fast 10.

A control glyph whose tight box is a thin bar along its baseline (at least 6
times as long as it is thick, measured along the char's angle so that a turned
table page counts) is now read as U+2212 when the page's char records are
built. The trace keeps the raw code and the record gets REC_UNMAPPED_MINUS.
On the benchmark's 299 papers this changes 676 characters in 22 papers; all
547 that are followed by a number are a minus in the publisher's XML, and the
page text of the 18 Cambridge papers now holds all 98 negative statistics.
…bracket, join a host a line wrap cut after a dot
@thesanogoeffect thesanogoeffect self-assigned this Dec 2, 2026
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.01774% with 36 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.02%. Comparing base (bc99570) to head (7ba08b7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #304      +/-   ##
==========================================
+ Coverage   91.00%   91.02%   +0.01%     
==========================================
  Files         349      350       +1     
  Lines       75493    75936     +443     
  Branches    14130    14234     +104     
==========================================
+ Hits        68705    69117     +412     
- Misses       4175     4189      +14     
- Partials     2613     2630      +17     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

… cuts

- Read a URL past zero-width spaces, joiners, BOM and soft hyphens, and
  leave them out of its target.
- Read a scheme the text layer spaced apart ("htt ps://") as the scheme,
  and join a host cut before its first dot with the token holding its domain.
- Join a URL the sentence splitter cut on a "." with the rest at the start
  of the next sentence of its paragraph.
- Join a wrap after "+", an OSF view-only key cut short, and a bare DOI cut
  after its prefix.
- Link a known deposit host printed with no path (aspredicted.org, osf.io,
  BioRender.com).
A ')' that closes no '(' of the URL ends it, so '(https://…/v2/)(17).'
no longer gives '…/v2/)(17'. The tilde operator, small tilde and
full-width tilde in a URL become '~'.
The cross-sentence join now also takes the next sentence when a page break
split the paragraph at the URL ("…m9.figshare." / "32196165"), within the
same section.

This branch has not been deployed

No deployments
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.

1 participant