Repository navigation
Accuracy push: text, statistics, tables and links before the JATS v2 holdout - #304
Open
thesanogoeffect wants to merge 21 commits into
Open
thesanogoeffect wants to merge 21 commits into
thesanogoeffect wants to merge 21 commits into
Conversation
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.
…ge header or footer
…ng, escapes, fractions, primes
…le HTML text nodes
…bracket, join a host a line wrap cut after a dot
…ps digits inside words
…-lpgjla # Conflicts: # CHANGELOG.md # bibr/structure/pdf_parser.py
Codecov Report❌ Patch coverage is 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:
|
…ils, hosts with a path
… 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
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.
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 examplet(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\nin 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):
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.
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_wizardfailure, which needstorch.The JATS v2 holdout was not run, scored or looked at.
Generated by Claude Code