发布

  • fix(hybrid/docling): collapse spanning cells so docling tables pass PDF/UA §7.2

    frostbyte_neo 发布于 2026-05-27 09:43:46 +00:00

    Objective: When the docling-fast backend produces a table with merged cells
    (colspan>1 or rowspan>1), every header row that contains a merged cell
    fails veraPDF rule PDF/UA-1 §7.2 (test 43) / PDF/UA-2 §8.2.5.26 "Table rows
    shall have the same number of columns (taking into account column spans)".
    In a 200-PDF batch, 9 documents fail for this reason — heuristic and
    hancom-ai backends are unaffected because they emit cells differently.

    Approach: docling reports the merged cell at its top-left start position
    AND emits redundant empty 1x1 placeholder cells at every slot the merged
    cell already covers. The previous loop wrote each cell into the grid
    independently, so the placeholders survived and inflated the row's
    effective column count. Mirror what HancomAISchemaTransformer already
    does for the same backend pathology: in a second pass, fill every slot
    inside a spanning cell's area with the same cell instance so
    AutoTaggingProcessor.addTableRow's identity check skips them. Clamp
    spans to the declared table bounds defensively.

    Evidence: 200-PDF batch with --hybrid docling-fast, --conformance ua1,ua2.

    Scenario Before After
    ua1 veraPDF pass 191 / 200 200 / 200
    ua2 veraPDF pass 191 / 200 200 / 200
    §7.2 test 43 failed checks across batch 9 0
    Wall clock (200 docs) ~3m27s ~3m13s

    Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com

    下载附件