Commit a0135640 authored by 赵小蒙's avatar 赵小蒙

修复spans为空list导致的IndexError: list index out of range

parent f10b4a50
......@@ -24,6 +24,9 @@ def line_sort_spans_by_left_to_right(lines):
return line_objects
def merge_spans_to_line(spans):
if len(spans) == 0:
return []
else:
# 按照y0坐标排序
spans.sort(key=lambda span: span['bbox'][1])
......
......@@ -77,7 +77,10 @@ def adjust_bbox_for_standalone_block(spans):
def modify_y_axis(spans: list, displayed_list: list, text_inline_lines: list):
# displayed_list = []
# 如果spans为空,则不处理
if len(spans) == 0:
pass
else:
spans.sort(key=lambda span: span['bbox'][1])
lines = []
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment