Repository navigation
fix(grobid): match whitespace-only first-word differences, explain unwritable sync mismatches - #99
Merged
Merged
Conversation
…writable sync mismatches The sync check of segmentation documents now matches a line to its feature row also by the row's first two tokens joined (column 2 of the feature file) or by the line's first two words joined, since the editor's text corrections never write whitespace-only differences such as "( §" corrected to "(§". Mismatches on lines whose change the text corrections cannot write into the PDF say so, from the new /unwritable-lines route (needs plugin API 1.12, else unsupported). Fixes #95 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S2kb9dTGETfyixjaXvSXRj
…-8ot2w2 # Conflicts: # plugins/grobid/src/pte_plugin_grobid/extensions/grobid-sync.js
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.
Requested by Christian · project thread
Fixes #95.
Cause
"Reload feature file" only asks GROBID about the PDF's text layer. So a TEI change leaves the sync check only after "Write text corrections to PDF" has written it there. Some of the reported changes could not be written (fixed in core mpilhlt/pdf-tei-editor#1036). "( §" → "(§" is a whitespace-only change that the writer ignores by design, but the line-based check compared first words, so it was flagged forever and its fix dropped the "§".
Changes
FeaturesVectorSegmentation.secondString, which repeats the first token for a line with one token). A line now also matches its row by the row's first two tokens joined, or by its own first two words joined. This is inlayout.row_forms()andline_token(), and inrowForms()andfirstTwoWords()in grobid-sync.js./feature-tokensreturnsjoined_tokens.GET /api/plugins/grobid/unwritable-linesreturns the lines whose first word starts a change the text corrections cannot write (text_corrections.unwritable_lines(), via the core'sderive_document_corrections()). With cores before plugin API 1.12 it returnsunsupported. grobid-sync fetches it once per document and PDF, only when there are mismatches. It then appends to those diagnostics: "The change cannot be written to the PDF (reason), so reloading the feature file does not resolve it."Tests
The Python tests (the core's plugin API 1.12 ones skip on older cores) and the JS tests (
npm test) pass locally.Generated by Claude Code