Skip to content

Commit ec9c3c3

Browse files
committed
docs(pdf): update PDF_CONFORMANCE for the word-cell grouping (6/16, 7/16)
Refresh the conformance table from a fresh scripts/conformance.sh run against live docling: the docling-parse word-cell grouping feeding TableFormer moves the heavy table docs closer to docling (2305.03393v1 93→32, 2203.01017v2 209→183, 2206.01062 198→164, redp5110 226→173). Adds the skipped_1page/skipped_2pages fixtures (now 16 total), and corrects the text-reconstruction notes: word cells now come from the parser (dp_lines::word_cells); pdfium keeps code cells + rasters. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QYCj8stK1TzKcy6crtTfha
1 parent 4855561 commit ec9c3c3

1 file changed

Lines changed: 26 additions & 7 deletions

File tree

PDF_CONFORMANCE.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The groundtruth is regenerated from **live published docling**, so it agrees wit
1313
1414
## Current state
1515

16-
**6 / 14 strict** · **7 / 14 whitespace-normalized.**
16+
**6 / 16 strict** · **7 / 16 whitespace-normalized.**
1717

1818
| PDF | diff | dominant remaining blocker |
1919
|---|---:|---|
@@ -24,20 +24,28 @@ The groundtruth is regenerated from **live published docling**, so it agrees wit
2424
| right_to_left_01 | **exact** | — (RTL period attachment) |
2525
| right_to_left_02 | **exact** | — (kashida dedup + page-number layout) |
2626
| amt_handbook_sample | 2 *(ws-ok)* | docling's spurious fraction double space — ours is more faithful |
27+
| 2305.03393v1 | 32 | title-page reading order + author-ID run spacing |
28+
| skipped_1page | 40 | image/diagram page (Korean); layout picture-detection |
29+
| skipped_2pages | 44 | image/diagram pages (Korean); layout picture-detection |
2730
| normal_4pages | 54 | reading order (heading numbering, footnote order) |
2831
| right_to_left_03 | 66 | RTL bidi |
29-
| 2305.03393v1 | 93 | title-page reading order + author-ID run spacing |
3032
| table_mislabeled_as_picture | 108 | layout over-detects tables (survey rendered as tables) |
31-
| 2206.01062 | 198 | TableFormer multi-row headers + title-page reading order |
32-
| 2203.01017v2 | 209 | TableFormer structure + reading order |
33-
| redp5110_sampled | 226 | TOC mis-classified as a picture; cover-page ordering |
33+
| 2206.01062 | 164 | TableFormer multi-row headers + title-page reading order |
34+
| redp5110_sampled | 173 | TOC mis-classified as a picture; cover-page ordering |
35+
| 2203.01017v2 | 183 | TableFormer structure + reading order |
3436

3537
`amt` is the 7th under the whitespace-normalized metric: its only diff is
3638
docling's spurious double space before the `1⁄4` fraction, where our single-spaced
3739
output is the more faithful rendering. The remaining non-exact PDFs are heavy
3840
multi-column / table docs whose gaps are model-level (TableFormer structure,
3941
layout classification, title-page reading order), not text-layer.
4042

43+
The heavy table docs improved with the docling-parse **word-cell** grouping now
44+
feeding TableFormer (2305.03393v1 93→32, 2203.01017v2 209→183, 2206.01062
45+
198→164, redp5110 226→173): the parser's per-word cells reproduce docling-parse's
46+
`word_cells` byte-for-byte, so cell-to-grid matching tracks docling more closely.
47+
See "Text reconstruction" below and `PDF_PARSER_NOTES.md` item 6.
48+
4149
## How the pipeline works
4250

4351
pdfium extracts the glyph layer and renders each page to a bitmap; an ONNX stack
@@ -79,8 +87,9 @@ on `lopdf`) that reconstructs each glyph's box from the *font's own advance
7987
widths* and the PDF text/graphics matrices — the same information docling-parse
8088
uses. It is the **default** text layer; set `DOCLING_PDFIUM_TEXT=1` to fall back
8189
to pdfium. Pages without a parseable text layer fall back to pdfium
82-
automatically, so scanned/OCR pages are unaffected. (pdfium still provides page
83-
rasters and word/code cells for TableFormer.)
90+
automatically, so scanned/OCR pages are unaffected. The parser also supplies the
91+
**word cells** TableFormer matches against (`DOCLING_PDFIUM_WORDS` keeps pdfium's);
92+
pdfium still provides page rasters, code cells, and link annotations.
8493

8594
The parser handles Type0/CID + Identity-H and simple Type1/TrueType fonts,
8695
ToUnicode CMaps (`bfchar`/`bfrange`), WinAnsi/MacRoman + `/Differences`
@@ -99,6 +108,16 @@ ligature recomposition, and loose-box geometry. On the clean parser boxes it use
99108
the Euclidean corner gap (matching docling); on pdfium's loose boxes it keeps the
100109
signed horizontal gap.
101110

111+
The same contraction also produces **word cells** (`dp_lines::word_cells`): a word
112+
is a maximal run of glyphs the contraction merges *without* inserting a separator
113+
space, so the per-word segments split at exactly the `delta < gap` points — which
114+
reproduces docling-parse's `word_cells` byte-for-byte (377/377 on 2305-pg9). These
115+
are the per-word tokens TableFormer matches against table-grid cells, replacing
116+
pdfium's word cells (roadmap item 6). Code cells stay on pdfium for now — the
117+
parser's space-glyph-only code grouping drops monospace spacing
118+
(`function add``functionadd`); opt into the parser code path with
119+
`DOCLING_PARSER_CODE` once that's fixed.
120+
102121
Other text/serializer/layout fixes matching docling: markdown escaping (`_``\_`,
103122
then HTML-escape `&`/`<`/`>`), typographic-punctuation normalization
104123
(```'`, ``/```-`, `“”``"`, or `'` for Hangul fonts), `@`-glue

0 commit comments

Comments
 (0)