From d3c10b24a41f35e31b34af84b9cda86c481bfc03 Mon Sep 17 00:00:00 2001 From: Maksym Lysak Date: Sat, 29 Mar 2025 09:33:54 +0100 Subject: [PATCH] Fix for the tables when using OCR Signed-off-by: Maksym Lysak --- docling/models/table_structure_model.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docling/models/table_structure_model.py b/docling/models/table_structure_model.py index b1a50f13..34a7d9da 100644 --- a/docling/models/table_structure_model.py +++ b/docling/models/table_structure_model.py @@ -229,6 +229,9 @@ class TableStructureModel(BasePageModel): cell_unit=TextCellUnit.WORD, bbox=table_cluster.bbox, ) + if len(tcells) == 0: + # In case word-level cells yield empty + tcells = table_cluster.cells else: # Otherwise - we use normal (line/phrase) cells tcells = table_cluster.cells