mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-31 14:34:40 +00:00
Fix the handling of orphan IDs in layout postprocessing
Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
parent
357d41cc47
commit
fefa06e1e7
@ -203,6 +203,7 @@ class LayoutPostprocessor:
|
|||||||
"""Initialize processor with cells and spatial indices."""
|
"""Initialize processor with cells and spatial indices."""
|
||||||
self.cells = cells
|
self.cells = cells
|
||||||
self.page_size = page_size
|
self.page_size = page_size
|
||||||
|
self.all_clusters = clusters
|
||||||
self.regular_clusters = [
|
self.regular_clusters = [
|
||||||
c for c in clusters if c.label not in self.SPECIAL_TYPES
|
c for c in clusters if c.label not in self.SPECIAL_TYPES
|
||||||
]
|
]
|
||||||
@ -267,7 +268,7 @@ class LayoutPostprocessor:
|
|||||||
# Handle orphaned cells
|
# Handle orphaned cells
|
||||||
unassigned = self._find_unassigned_cells(clusters)
|
unassigned = self._find_unassigned_cells(clusters)
|
||||||
if unassigned:
|
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 = []
|
orphan_clusters = []
|
||||||
for i, cell in enumerate(unassigned):
|
for i, cell in enumerate(unassigned):
|
||||||
conf = 1.0
|
conf = 1.0
|
||||||
|
Loading…
Reference in New Issue
Block a user