fix(table): preserve native line cells when word cells are absent #5531
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.40) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 279 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.337
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5531"
general
weight: 0.35
yxshee
Keep native
textline_cellsfromtable_cluster.cellsin_words_and_ocr_cells()when a PDF backend does not populateword_cells(such asPyPdfiumDocumentBackend).Issue resolved by this Pull Request:
Resolves #5237
Checklist:
Review evidence:
PyPdfiumPageBackend.get_segmented_page()leavesword_cells=[](has_words=False) and populates onlytextline_cells. When OCR keeps at least one cell intable_cluster.cells,_words_and_ocr_cells()returned only those OCR lines (len(tcells) > 0), bypassing the empty-token fallback inTableStructureModel.predict_tables()and dropping every native table cell. When paired with a word-level OCR plugin, OCR words over kept native lines were also not suppressed becausenative_wordswas empty._words_and_ocr_cells()retains uncovered native lines fromcluster_cellsalongside native word cells (mirroring the OCR line fallback), ignores whitespace-only word cells before coverage checks, and filters OCR words against the kept native cells. Existing behavior when nativeword_cellscover the table (e.g.,docling-parse), in full-page OCR mode, and with word-level OCR plugins is preserved.-
uv run --no-sync pytest tests/test_table_structure_model.py -v: 5 new regression tests fail onmain(0f3564c) and all 7 tests pass after the fix.-
uv run --no-sync pytest tests/test_table_structure_model.py tests/test_ocr_rects_dedup.py tests/test_ocr_options_force_full_page.py tests/test_skip_cell_extraction.py -v:34 passed.-
uv run --no-sync prek run --files docling/models/stages/table_structure/table_structure_model.py tests/test_table_structure_model.py: all hooks passed (ruff,ruff-format,ty,tach,tach-module-coverage,insert-license,max-lines).- Not run locally:
ml_pdf_modelend-to-end tests (tests/test_e2e_table_structure_ocr.py,pypdfium2+ TableFormer weights) because the local slim environment does not includepypdfium2or ML model weights.