Skip to content

Rebuild training data B-/I- from element boundaries - #700

Merged
de-code merged 1 commit into
mainfrom
training-tei-sibling-entity-boundaries
Aug 20, 2026
Merged

Rebuild training data B-/I- from element boundaries#700
de-code merged 1 commit into
mainfrom
training-tei-sibling-entity-boundaries

Conversation

@de-code

@de-code de-code commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

part of https://github.com/eLifePathways/ScienceBeam2.0/issues/147

AbstractTrainingTeiParser assigned the entity prefix only when the label changed, and skipped whitespace-only text nodes without touching the previous label. Two sibling elements sharing a label, with only whitespace between them, therefore came back as one entity: the second element's start was lost, and generate_delft_data maps our B- to GROBID's I- start marker, so a start the parser never emitted could not reappear in the artifact. Where a boundary did survive it survived incidentally - any non-whitespace separator is labelled O, which changed the previous label and restored the next start, so two idno elements separated by a comma were kept apart and the same pair separated by a space were not.

is_start on TeiTrainingText already means "first text run in this element", including across , so the guard is all that had to go. A whitespace-only run no longer spends the flag either, which is what a single space before a nested used to cost.

The semantics is one entity per element occurrence: text returning to a labelled parent after a labelled child continues the parent's entity. That is the inverse of what the writer does, where a B- opens a new sibling element, and it keeps whole across the markers the fulltext model nests inside it. GROBID's SAX parsers declare begin inside writeField and so start a field per text run, which would split a paragraph at every citation marker.

Over the committed generated corpus the reference segmenter gains 1786 reference starts - 624 to 1678 for ore, 911 to 1643 for scielo_preprints-jats - and the header model 10. Citation, affiliation-address and segmentation are unchanged, every label and every document. On a collapsed document the delft output differs in the label column alone: 152 become I- and no token moves.

The citation identifier test asserted the merged value as known behaviour; it now round-trips both identifiers.

AbstractTrainingTeiParser assigned the entity prefix only when the label
changed, and skipped whitespace-only text nodes without touching the previous
label. Two sibling elements sharing a label, with only whitespace between
them, therefore came back as one entity: the second element's start was lost,
and generate_delft_data maps our B- to GROBID's I- start marker, so a start
the parser never emitted could not reappear in the artifact. Where a boundary
did survive it survived incidentally - any non-whitespace separator is
labelled O, which changed the previous label and restored the next start, so
two idno elements separated by a comma were kept apart and the same pair
separated by a space were not.

is_start on TeiTrainingText already means "first text run in this element",
including across <lb/>, so the guard is all that had to go. A whitespace-only
run no longer spends the flag either, which is what a single space before a
nested <label> used to cost.

The semantics is one entity per element occurrence: text returning to a
labelled parent after a labelled child continues the parent's entity. That is
the inverse of what the writer does, where a B- opens a new sibling element,
and it keeps <paragraph> whole across the markers the fulltext model nests
inside it. GROBID's SAX parsers declare begin inside writeField and so start a
field per text run, which would split a paragraph at every citation marker.

Over the committed generated corpus the reference segmenter gains 1786
reference starts - 624 to 1678 for ore, 911 to 1643 for
scielo_preprints-jats - and the header model 10. Citation,
affiliation-address and segmentation are unchanged, every label and every
document. On a collapsed document the delft output differs in the label column
alone: 152 <reference> become I-<reference> and no token moves.

The citation identifier test asserted the merged value as known behaviour; it
now round-trips both identifiers.
@de-code de-code self-assigned this Aug 20, 2026
@de-code
de-code merged commit 4194012 into main Aug 20, 2026
6 checks passed
@de-code
de-code deleted the training-tei-sibling-entity-boundaries branch August 20, 2026 02:46
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