Repository navigation
Give a page its printed number as the unit's label - #825
Conversation
doclingParts fills each page unit's label from the first furniture part on the page that reads as a page number, kept only when the nearest labelled page within 2 pages before or after has the same offset. Lone page numbers at a page's edge count, since docling-parts makes them furniture: on seed 7 of the Docling export 73.70 % of pages keep a label, against 73.74 % for labels_footers.py with body edge numbers.
Pin the nearest-neighbour rule with a test, say in ADR 0055 that labels are built and how many the wider rule drops, and keep comments to one line.
|
Ready for review. Blind review, a claim-checking review and a check of the fixes are done and CI passes. Open: lone page numbers at a page's edge count as labels, so seed 7 keeps 73.70 % against the issue's 70.5 % (the target moved to 73.74 %, see the comment on #633). #824 edits the same ADR 0055 lines and says parts are stored without labels: merging this one first keeps |
| | Pages with a character outside the BMP | 0.05 and 0.16 % | same | | ||
| | Tables with merged cells | 26 % | same | | ||
| | Pages with a printed label kept by the rule | 70.5 and 66.2 % | same | | ||
| | Pages with a printed label kept by the rule | 70.5 and 66.2 %; 73.7 % in the first with lone edge numbers, as `docling-parts` reads | same | |
There was a problem hiding this comment.
Nit: New ADR label figures not backed by benchmark scripts or results
The Measurements section says its numbers come from the scripts and results in benchmarks/ingestion/blocks/parts/. The new figures (73.7 % of pages labelled, and 2.5 % of labels not kept at line 161) appear in neither. The committed script also does not count lone page numbers at a page's edge as furniture, so nobody can reproduce them.
Rule: Docs and ADRs that claim more than the code does
Evidence and fix
Evidence: Line 116 of the ADR says the scripts and results are in benchmarks/ingestion/blocks/parts/. results.md:63 records only 70.5 % and 66.2 %. git grep -n "73\.7" -- benchmarks docs finds no match under benchmarks/ingestion/blocks/parts. labels_footers.py and stats.py only treat text as a label source when it is furniture or a page_header, page_footer or page_number label, and have no edge-number rule.
Fix: Add the run that produced 73.7 % and 2.5 % to benchmarks/ingestion/blocks/parts/results.md, and extend labels_footers.py with the lone-edge-number rule. If that is not possible, remove the two new figures from lines 131 and 161.
There was a problem hiding this comment.
Model review1 finding: 1 open, 0 fixed, 0 dismissed. WalkthroughThe pull request makes
Findings
Fix the open findings with your coding agentReviewed at 426a461 with claude-opus-5-5 in 1.2 min. Pushes are checked against open findings, and fixed ones are resolved. Add the label |
What and why
doclingPartshadlabelnullParts
pageLabels(units)inpackages/ingest/src/page-labels.ts, run bydoclingPartsseqorder, that reads as a page number (12,s. 12,side 3 av 9,page 3 of 9,3/9)docling-partsstays version 1; no storage code changesDocs
docs/adr/README.md: "built with page labels"More background
labels_footers.py, which reads only Docling's own furniturerule_plus_body_band_coverage_pct: 73.74 % on seed 7. This PR: 73.70 %- 12 -are not read: 38 pages (0.34 %) in 2 files of seed 7textOf), sopageLabelsmatches it as it isCloses #633
Risk
Low. Nothing that runs calls
doclingPartsyet; the units it returns now carry labels.Undo
Revert is enough.
How it was tested
npm run checklocally: 7 tests outside the diff timed out at a load average of 57 (Test timed out in 15000ms, no assertion). CI runs the full suite and passespackages/ingest/src/page-labels.test.ts: "a printed label is kept only when a neighbouring page agrees", "only the nearest labelled page on each side is compared", "a label with no labelled page within 2 pages is dropped", "a chapter number in a page header is not a page label", "side 3 av 9 gives the label 3", "a number in the body is never a label", "a lone page number at the page's edge is a label", "a label drops its leading zeros", "the pattern is linear on a long adversarial string"benchmarks/ingestion/blocks/parts/labels_footers.py):labels_footers.pyLabels checked against the PDFs: 139 KUDOS PDFs kept locally have Docling output, with 4,765 kept labels (2,544 from footers, 2,126 from headers, 95 lone edge numbers). For 4,660 the number is in the PDF's own text layer in the top or bottom 12 % of the page, read with PDFKit. The 27 + 105 without one (outlined numbers, scans) were spot-checked on rendered pages and are right. Wrong: 2, in one file, where numbered boxes near the top (
8,9) are Docling page headers on two pages in a row. A two-page spread printed 8 and 9 gets the label 9. All 95 edge-number labels are rightnpm run checkpassesChecklist
packages/providers-*docs/architecture/modulesare updated if a contract, boundary or module changed