Skip to content

Commit 2fe18b0

Browse files
committed
Address #4324
Offer option to return raw clustering results.
1 parent cc114d7 commit 2fe18b0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9117,7 +9117,8 @@ def remove_rotation(self):
91179117
return rot # the inverse of the generated derotation matrix
91189118

91199119
def cluster_drawings(
9120-
self, clip=None, drawings=None, x_tolerance: float = 3, y_tolerance: float = 3
9120+
self, clip=None, drawings=None, x_tolerance: float = 3, y_tolerance: float = 3,
9121+
final_filter: bool = True,
91219122
) -> list:
91229123
"""Join rectangles of neighboring vector graphic items.
91239124

@@ -9210,6 +9211,8 @@ def are_neighbors(r1, r2):
92109211
prects = sorted(set(prects), key=lambda r: (r.y1, r.x0))
92119212

92129213
new_rects = sorted(set(new_rects), key=lambda r: (r.y1, r.x0))
9214+
if not final_filter:
9215+
return new_rects
92139216
return [r for r in new_rects if r.width > delta_x and r.height > delta_y]
92149217

92159218
def get_fonts(self, full=False):

0 commit comments

Comments
 (0)