Fix split text bug

pull/2/head
Vinayak Mehta 2019-03-22 02:28:29 +05:30
parent 8ea4ec3de8
commit ce727d9558
1 changed files with 8 additions and 0 deletions

View File

@ -479,6 +479,10 @@ def split_textline(table, textline, direction, flag_size=False, strip_text=''):
(obj.x0 + obj.x1) / 2 <= cut[1]): (obj.x0 + obj.x1) / 2 <= cut[1]):
cut_text.append((r, cut[0], obj)) cut_text.append((r, cut[0], obj))
break break
else:
# TODO: add test
if cut == x_cuts[-1]:
cut_text.append((r, cut[0] + 1, obj))
elif isinstance(obj, LTAnno): elif isinstance(obj, LTAnno):
cut_text.append((r, cut[0], obj)) cut_text.append((r, cut[0], obj))
elif direction == 'vertical' and not textline.is_empty(): elif direction == 'vertical' and not textline.is_empty():
@ -496,6 +500,10 @@ def split_textline(table, textline, direction, flag_size=False, strip_text=''):
(obj.y0 + obj.y1) / 2 >= cut[1]): (obj.y0 + obj.y1) / 2 >= cut[1]):
cut_text.append((cut[0], c, obj)) cut_text.append((cut[0], c, obj))
break break
else:
# TODO: add test
if cut == y_cuts[-1]:
cut_text.append((cut[0] - 1, c, obj))
elif isinstance(obj, LTAnno): elif isinstance(obj, LTAnno):
cut_text.append((cut[0], c, obj)) cut_text.append((cut[0], c, obj))
except IndexError: except IndexError: