Skip to content

Commit a4be0df

Browse files
authored
fix issue when packages and containers do not align at all -> max([]) (#891)
Signed-off-by: Henry Lindeman <hmlindeman@yahoo.com>
1 parent f4bff69 commit a4be0df

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/sycamore/sycamore/transforms/table_structure/table_transformers.py

+4
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,12 @@ def slot_into_containers(
244244
for container_num, container in sorted_co:
245245
# If the container starts after the package ends, break
246246
if not _early_exit_vertical and container["bbox"][0] > package["bbox"][2]:
247+
if len(match_scores) == 0:
248+
match_scores.append({"container": container, "container_num": container_num, "score": 0})
247249
break
248250
elif _early_exit_vertical and container["bbox"][1] > package["bbox"][3]:
251+
if len(match_scores) == 0:
252+
match_scores.append({"container": container, "container_num": container_num, "score": 0})
249253
break
250254
container_rect = BoundingBox(*container["bbox"])
251255
intersect_area = container_rect.intersect(package_rect).area

0 commit comments

Comments
 (0)