浏览代码

修复bug

fangjiasheng 1 年之前
父节点
当前提交
2f808ba637
共有 3 个文件被更改,包括 5 次插入0 次删除
  1. 2 0
      botr/rules/get_table_by_rules.py
  2. 2 0
      format_convert/convert_pdf.py
  3. 1 0
      format_convert/utils.py

+ 2 - 0
botr/rules/get_table_by_rules.py

@@ -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])

+ 2 - 0
format_convert/convert_pdf.py

@@ -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)
 
         # 删除最外层嵌套边框

+ 1 - 0
format_convert/utils.py

@@ -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 = []