@@ -74,6 +74,8 @@ def get_table_by_rule(img, text_list, bbox_list, table_location, show=0):
# 根据bbox_list,计算与table_location左上角坐标距离,锁定第一个bbox
table_left_up_point = [table_location[0], table_location[1]]
min_distance = 100000000000
+ if not bbox_list:
+ return [], [], [], {}
first_bbox = bbox_list[0]
for bbox in bbox_list:
distance = abs(bbox[0][0] - table_left_up_point[0]) + abs(bbox[0][1] - table_left_up_point[1])
@@ -1174,6 +1174,8 @@ class PDFConvert:
cross_line_list = get_cross_line(cross_line_list, threshold=1, cross_times=1)
# 合并线条
+ if not cross_line_list:
+ return []
cross_line_list = merge_line(cross_line_list)
# 删除最外层嵌套边框
@@ -340,6 +340,7 @@ class LineTable:
self.list_crosspoints = self.recognize_crosspoints(list_line)
self.from_pdf = from_pdf
self.splited = splited
+ self.connect_bbox_list = []
# 聚类
cluster_crosspoints = []