mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-23 18:45:00 +00:00
fix: Keep formula clusters also when empty (#1970)
Keep formula clusters also when empty Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
parent
90a7cc4bdd
commit
67441ca418
@ -267,9 +267,14 @@ class LayoutPostprocessor:
|
|||||||
# Initial cell assignment
|
# Initial cell assignment
|
||||||
clusters = self._assign_cells_to_clusters(clusters)
|
clusters = self._assign_cells_to_clusters(clusters)
|
||||||
|
|
||||||
# Remove clusters with no cells (if keep_empty_clusters is False)
|
# Remove clusters with no cells (if keep_empty_clusters is False),
|
||||||
|
# but always keep clusters with label DocItemLabel.FORMULA
|
||||||
if not self.options.keep_empty_clusters:
|
if not self.options.keep_empty_clusters:
|
||||||
clusters = [cluster for cluster in clusters if cluster.cells]
|
clusters = [
|
||||||
|
cluster
|
||||||
|
for cluster in clusters
|
||||||
|
if cluster.cells or cluster.label == DocItemLabel.FORMULA
|
||||||
|
]
|
||||||
|
|
||||||
# Handle orphaned cells
|
# Handle orphaned cells
|
||||||
unassigned = self._find_unassigned_cells(clusters)
|
unassigned = self._find_unassigned_cells(clusters)
|
||||||
|
Loading…
Reference in New Issue
Block a user