Skip to content

Fix two reference-scoring errors (metrics v7) and recover two kinds of lost DOI - #294

Draft
thesanogoeffect wants to merge 3 commits into
mainfrom
thesanogoeffect/improvements
Draft

thesanogoeffect wants to merge 3 commits into
mainfrom
thesanogoeffect/improvements

Conversation

@thesanogoeffect

@thesanogoeffect thesanogoeffect commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

What this changes

Two independent changes, one commit each, and a changelog commit with the measured numbers. Both were found by running --fast on a uniform sample of PubMed Central papers and reading the failures against the publisher XML.

1. Reference scoring, metrics_version 5 to 7 (853b5abf). ref_matching_f1 was wrong in two ways that no extraction could do anything about.

  • A gold record made from publisher XML holds an empty entry for each reference the XML gives as plain text. The entry counted as a missed reference, and the extraction of that reference as a spurious one, so a perfect extraction scored below 1.0. Such entries are now set aside.
  • A reference printed as authors, journal, year, volume and page could only match on first author and year, and that level read the first word of the author string, which is an initial for "J. M. Smith". The first author is now compared by name words, and the same year, volume and first page match.

Two rules are stricter: a shared first initial is not a shared first author, and the citation-string level needs the author's name as a whole word.

2. DOI (a80b465e).

  • Older BioMed Central articles print the DOI once, after the last reference and directly above "Cite this article as:". It was read as the last reference's DOI, so the paper had none. A labelled DOI that opens its sentence and that the citation cue follows directly is now the paper's own.
  • A running footer that prints the DOI and then the page number, with no gap in the text layer, gave a different DOI on each page, and the selection abstained. Those are now rejected as line_join_overrun.

Measured

Scorer. On stored predictions for the 300 papers of the public JATS benchmark, the answer key scored against itself passes 100% of both sets; under version 5 it passed 96.5% and 93.0%. Papers passing all four floors, version 5 to version 7:

behavioural science (200) other fields (100)
bibr, default path 94.0% to 97.5% 88.0% to 96.0%
bibr, --fast 88.5% to 92.0% 91.0% to 99.0%
GROBID 0.9.1 61.5% to 64.0% 62.0% to 71.0%

No paper scores lower. Scores made with versions 5 and 7 do not compare; benchmark scores published before this change were made with version 5.

DOI rules. --fast on CPU, run on main as it was before 0.9.2 was prepared (3b7753a9) and on a build with the DOI rules on top of it, both scored with version 7:

papers DOI passing all four floors
Public JATS benchmark 300 none changed 288, unchanged
PubMed Central sample not used to write the rules 320 6 better, 0 worse 281 to 287

The rules only fill a DOI where none was extracted, so a wrong DOI would score 0 before and after and would not show as worse. Counted on the exports instead: in the second sample a DOI was added in 6 papers, each the DOI of the publisher XML, and no other paper's DOI changed.

The rules were written on a first sample of 168 PubMed Central papers, where 7 of 163 papers with a DOI had none extracted; the changelog has those counts.

Not measured

  • This exact head was not run. The build that was measured held these two changes and a corresponding-author rule that was part of this PR until 27 November (see below). That rule is in the author address pass, and the DOI selection does not read the corresponding-author flag. The corresponding-author flag is not one of the four floors, so the 281 to 287 is the DOI rules'. Apart from that flag, no scored field changed on any paper of either run.
  • Not rerun after the rebase. The branch was rebased onto main after Prepare 0.9.2: Wave 4 speed-ups, uv tool setup, demo UX, version bump, and dependency updates #285 (0.9.2). The runs above predate it. Prepare 0.9.2: Wave 4 speed-ups, uv tool setup, demo UX, version bump, and dependency updates #285 does not touch the files this PR changes, but its Wave 4 changes touch the --fast text-layer path (the layout render resolution), and the rebased head was not rerun.
  • The default path was not rerun. For it, the DOI rules were replayed on the stored DOI candidates of the benchmark; neither applies to any of the 300 papers.

Relation to #292

This PR first carried a third commit that flags the corresponding author from a paper's only printed address. It conflicted with #292 in bibr/extract/author_email_harvester.py, and its counts were against main without #292. The commit was taken out of this branch on 27 November and is being rerun on top of #292's head. It will be proposed separately if it still adds enough.

What is left overlaps with #292 only in CHANGELOG.md, where both add entries under Unreleased.

Tests

5,093 tests pass locally in the evaluation, extraction and pipeline test directories and the docs sync test; ruff check and ruff format --check are clean on the changed files. New tests use made-up names and DOIs.

@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.15%. Comparing base (4bfeebc) to head (5c74d53).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #294   +/-   ##
=======================================
  Coverage   91.14%   91.15%           
=======================================
  Files         344      344           
  Lines       73647    73688   +41     
  Branches    13667    13677   +10     
=======================================
+ Hits        67125    67167   +42     
  Misses       4041     4041           
+ Partials     2481     2480    -1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thesanogoeffect
thesanogoeffect force-pushed the thesanogoeffect/improvements branch from 4e5c174 to f78fb95 Compare November 27, 2026 19:08
@thesanogoeffect thesanogoeffect changed the title Fix two reference-scoring errors (metrics v7), flag the corresponding author from a paper's only address, and recover two kinds of lost DOI Fix two reference-scoring errors (metrics v7) and recover two kinds of lost DOI Nov 27, 2026
…ences nothing can match

ref_matching_f1 was wrong in two ways no extraction could do anything about.

A gold record made from publisher XML holds an empty entry for each
reference the XML gives as plain text. The entry counted as a missed
reference and the extraction of that very reference as a spurious one, so a
perfect extraction scored below 1.0. Such an entry is now set aside from the
recall, precision and per-field denominators; the per-paper count is
ref_field_counts.gold_refs_unmatchable. A gold record may carry the printed
string as bib[].unstructured instead.

A reference printed as authors, journal, year, volume and page could only
match on first author and year, and that level read the first word of the
author string: an initial for 'J. M. Smith'. The first author is now compared
by name words, and the same year, volume and first page match at 0.8.

Two rules are stricter: a shared first initial is not a shared first author,
and the citation-string level needs the author's name as a whole word.

metrics_version goes from 5 to 7 (6 was used for another counter). On stored
predictions for the 300 papers of the public JATS benchmark the answer key
scored against itself passes 100% of both sets (96.5% and 93.0% before), and
no paper scores lower. The CHANGELOG has the per-tool shifts.
Two ways a paper lost a DOI that its pages print, both found in a uniform
sample of PubMed Central papers.

Older BioMed Central articles print the DOI once: on a line of its own after
the last reference, directly above 'Cite this article as: ...'. That line was
read as the last reference's DOI, so the paper had none and its last
reference carried the paper's. A DOI whose label opens its sentence and that
the article's citation cue follows directly is now the paper's own, unless
the citation block prints a DOI itself. A DOI that ends a reference entry
does not qualify, and a DOI the first page labels still outranks it.

A running footer prints the DOI and then the page number. Where the text
layer leaves no gap, every such page gave a DOI of its own and the real one
was rejected as cut short, so the selection abstained. Two or more header or
footer DOIs that extend one printed DOI by digits alone, with ends as close
together as page numbers, are now rejected as line_join_overrun.

Applied to the stored candidates of that sample's run, the rules give 4 of 7
papers without a DOI their DOI and change no other paper; neither applies to
any of the 300 papers of the public JATS benchmark.
The DOI entry gave an estimate from stored DOI candidates. It now also
gives what runs with --fast before and after the change measured: on the
public JATS benchmark, and on a second sample of 320 PubMed Central papers
that was not used to write the rules.

The build that was measured also carried a corresponding-author rule that is
not on this branch. That rule is in the author address pass; the DOI
selection does not read the corresponding-author flag.

The scorer entry's sentence about the uniform sample now gives counts for
168 papers scored with version 5 and version 7.
@thesanogoeffect
thesanogoeffect force-pushed the thesanogoeffect/improvements branch from f78fb95 to 5c74d53 Compare November 27, 2026 19:46

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