We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c2f94d2 commit ac0371bCopy full SHA for ac0371b
camelot/parsers/network.py
@@ -238,7 +238,15 @@ def search_header_from_body_bbox(
238
textline_center = 0.5 * (textline.x0 + textline.x1)
239
if textline.y0 > top and left < textline_center < right:
240
all_above.append(textline)
241
- closest_above = min(all_above, key=lambda tl: tl.y0, default=None)
+ closest_above = None
242
+ all_above = [
243
+ tl
244
+ for tl in textlines
245
+ if tl.y0 > top and left < 0.5 * (tl.x0 + tl.x1) < right
246
+ ]
247
+
248
+ if all_above:
249
+ closest_above = min(all_above, key=lambda tl: tl.y0)
250
251
if closest_above and closest_above.y0 < top + max_v_gap:
252
# We have a candidate cell that is within the correct
0 commit comments