From 7afad7e52da642b258edd67f8f4815ea430f05e1 Mon Sep 17 00:00:00 2001 From: Maxim Lysak <101627549+maxmnemonic@users.noreply.github.com> Date: Sat, 29 Mar 2025 10:06:00 +0100 Subject: [PATCH] fix: Fixes tables when using OCR (#1261) Fix for the tables when using OCR Signed-off-by: Maksym Lysak Co-authored-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 b1a50f1..34a7d9d 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