Skip to content

Commit

Permalink
Fix the handling of orphan IDs in layout postprocessing
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Auer <[email protected]>
  • Loading branch information
cau-git committed Mar 5, 2025
1 parent 357d41c commit fefa06e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docling/utils/layout_postprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def __init__(self, cells: List[Cell], clusters: List[Cluster], page_size: Size):
"""Initialize processor with cells and spatial indices."""
self.cells = cells
self.page_size = page_size
self.all_clusters = clusters
self.regular_clusters = [
c for c in clusters if c.label not in self.SPECIAL_TYPES
]
Expand Down Expand Up @@ -267,7 +268,7 @@ def _process_regular_clusters(self) -> List[Cluster]:
# Handle orphaned cells
unassigned = self._find_unassigned_cells(clusters)
if unassigned:
next_id = max((c.id for c in clusters), default=0) + 1
next_id = max((c.id for c in self.all_clusters), default=0) + 1
orphan_clusters = []
for i, cell in enumerate(unassigned):
conf = 1.0
Expand Down

0 comments on commit fefa06e

Please sign in to comment.