瀏覽代碼

table识别问题

chencheng 1 年之前
父節點
當前提交
079644ae2b
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      cores/post_decorators.py

+ 6 - 2
cores/post_decorators.py

@@ -9,7 +9,9 @@ def rule1_decorator(f, *args, **kwargs):
     '''
     predict_line = args[1]
     predict_line = f(*args, **kwargs)
-    idx = predict_line.index('')
+    idx = 0
+    if '' in predict_line:
+        idx = predict_line.index('')
     try:
         if idx == 1:
             if '项目' in predict_line[0] and '每100克' in predict_line[2]:
@@ -97,7 +99,9 @@ def rule6_decorator(f, *args, **kwargs):
     '''
     predict_line = args[1]
     predict_line = f(*args, **kwargs)
-    idx = predict_line.index('')
+    idx = 0
+    if '' in predict_line:
+        idx = predict_line.index('')
     try:
         if idx == 1:
             if '项目' in predict_line[0] and '每份' in predict_line[2] and '营养素参考值' in predict_line[2]: