Skip to content

Improve training data quality for references#678

Merged
de-code merged 5 commits into
mainfrom
training-data-generation-reference-author
Jun 25, 2026
Merged

Improve training data quality for references#678
de-code merged 5 commits into
mainfrom
training-data-generation-reference-author

Conversation

@de-code

@de-code de-code commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

de-code added 3 commits June 24, 2026 12:29
part of eLifePathways/ScienceBeam2.0#105

The XPath for the REFERENCE_AUTHOR sub-field targeted <string-name>
elements outside <person-group>, which does not exist in standard JATS.
Authors live inside <person-group person-group-type="author">, and the
not(ancestor::person-group) guard would have excluded them regardless.

No reference author tokens were being annotated in generated citation
training data. Fixed the XPath and added a unit test.
<etal/> carries no text content, so it was silently dropped from the
author needle. The generated training data now includes "et al." in the
<author> span, matching the grobid training data convention.
…g data

- Sub-fields sorted longest-first so shorter needles (e.g. label "1")
  cannot displace longer ones (e.g. year "1987") at the same position
- Full masking applied to all sub-field types, not only REFERENCE_AUTHOR
- Within-gap mid-token guard advances prev_included_end so the gap chain
  is not broken by overlapping SW noise blocks
- Tail extension off-by-one fixed (inclusive gap=3 boundary)
- Surname-only fallback extended to also find given-name initials within
  gap=3 of the matched surname, in both mid-token and regular fallback paths
- Gap fill tolerates unlabeled tokens (entry=None) so "et al." and
  interstitial periods no longer reset the fill state
- Per-name author sub-fields: only REFERENCE_AUTHOR ranges are masked
  across names; other sub-fields are single-occurrence and do not need it
@de-code de-code self-assigned this Jun 25, 2026
de-code added 2 commits June 25, 2026 10:39
SW character-level matching allowed "200" to match inside "2020" by
consuming characters with a gap (2,0,_,0). For digit-only needles
(years, page numbers, volumes, issues) the correct match is always an
exact token — "200" cannot be a prefix or suffix of a longer number.

_is_pure_number + _exact_number_match bypass SW for these needles,
requiring the match to start at a token boundary and end at a token
boundary. Two new _TokenIndex helper methods (is_in_token,
is_token_boundary_after) expose the boundary checks without accessing
the protected _token_index_at attribute directly.
When multiple windows produce a hit, the first match was returned
regardless of whether it was exact (single contiguous block) or gapped
(SW used character-level gaps to cover the needle). This caused "2020b"
to be labeled at the first plain "2020" occurrence via a 0.8-quality
gap match, while the true "2020b" token later in the text was ignored.

_fuzzy_match_field_value now stores the first gap match as a fallback
and continues scanning, returning immediately only when an exact
contiguous match is found. The existing pure-number path
(_exact_number_match) is unaffected; this change covers all other
tokens.
@de-code de-code marked this pull request as ready for review June 25, 2026 11:21
@de-code de-code merged commit c689e76 into main Jun 25, 2026
7 checks passed
@de-code de-code deleted the training-data-generation-reference-author branch June 25, 2026 11:22
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