Browse Source

table识别问题

chencheng 1 year ago
parent
commit
079644ae2b
1 changed files with 6 additions and 2 deletions
  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]: