Skip to content

Fix generate_delft_data round-trip for citation model training TEI#683

Merged
de-code merged 2 commits into
mainfrom
fix-generate-training-data-for-citation-model
Jul 1, 2026
Merged

Fix generate_delft_data round-trip for citation model training TEI#683
de-code merged 2 commits into
mainfrom
fix-generate-training-data-for-citation-model

Conversation

@de-code

@de-code de-code commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

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

biblScope and idno elements in citation training TEI can carry extra
attributes added purely for downstream consumers (sciencebeam-judge's
fpage extraction, and external-identifier-type detection), which broke
generate_delft_data's ability to parse the TEI back into labels:

  • biblScope[@Unit="page"] elements post-processed with @from/@to
    page-range attributes raised "only supporting up to one attribute"
    when matching the element path. from/to are metadata only, never used
    for label lookup, so they're now excluded from the path expression.

  • idno elements are tagged with any detected external identifier type
    (DOI, PMCID, PMID, ARXIV, PII), but only idno[@type="DOI"] had a path
    back to a label (); bare idno mapped to . Once tagged
    type="PMCID" etc., there was no matching path. The other types now
    alias back to , matching the label they were generated from.

Adds regression tests for both cases, including a full round-trip test
(generate training TEI, including post-processing, then parse it back).

de-code added 2 commits July 1, 2026 19:31
…ookup

biblScope elements generated for the citation model can carry from/to
page-range attributes (added for sciencebeam-judge's fpage extraction)
alongside unit. generate_delft_data failed to parse such elements back
because the element-path matcher only supported a single attribute.
…fier type

get_post_processed_xml_root tags <idno> elements with any detected external
identifier type (DOI, PMCID, PMID, ARXIV, PII), but only idno[@type="DOI"] had
a training path back to a label (<idno>); bare idno mapped to <pubnum>. Once
tagged with e.g. type="PMCID", generate_delft_data failed to parse the
element back since no path matched. Alias the other detected types back to
<pubnum>, matching the label they were generated from.
@de-code de-code self-assigned this Jul 1, 2026
@de-code de-code marked this pull request as ready for review July 1, 2026 19:03
@de-code de-code merged commit 0baf082 into main Jul 1, 2026
6 checks passed
@de-code de-code deleted the fix-generate-training-data-for-citation-model branch July 1, 2026 19:04
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