d3de42e6 by 周伟奇

fix HIL contract

1 parent a7933381
......@@ -10,15 +10,14 @@ from .get_char import Finder
def predict(pdf_info, file_cls):
"""Summary
Args:
pdf_info (TYPE): Description
file_cls (TYPE): file_cls = 0: 售后回租合同; file_cls = 1: 车辆处置协议; file_cls = 2: 车辆租赁抵押合同
Returns:
TYPE: Description
"""
# 0: 售后回租合同
pdf_info_0 = []
for pno in pdf_info:
......@@ -30,7 +29,6 @@ def predict(pdf_info, file_cls):
bbox, text = span['bbox'], span['text']
if '售后回租合同_' in text:
pdf_info_0.append(pdf_info[pno])
# 1: 车辆处置协议
pdf_info_1 = []
for pno in pdf_info:
......@@ -42,7 +40,6 @@ def predict(pdf_info, file_cls):
bbox, text = span['bbox'], span['text']
if '售后回租合同附件一' in text:
pdf_info_1.append(pdf_info[pno])
# 2: 车辆租赁抵押合同
pdf_info_2 = []
for pno in pdf_info:
......@@ -54,7 +51,6 @@ def predict(pdf_info, file_cls):
bbox, text = span['bbox'], span['text']
if '车辆租赁抵押合同_' in text:
pdf_info_2.append(pdf_info[pno])
is_clczxy = False
# 如果 pdf_info_1 == 4 页,则说明此时输入包含了车辆处置协议
if len(pdf_info_1) == 4 and file_cls == 1 and len(pdf_info_0) != 0:
......@@ -62,7 +58,6 @@ def predict(pdf_info, file_cls):
pdf_info = dict()
for pno, page_info in enumerate(pdf_info_1):
pdf_info[str(pno)] = page_info
f = Finder(pdf_info)
if file_cls == 0:
results = f.get_info()
......@@ -72,13 +67,11 @@ def predict(pdf_info, file_cls):
if file_cls == 2:
# 提取信息 ———— 车辆租赁抵押合同
results = f.get_info_2()
if is_clczxy == True:
if is_clczxy is True:
for key in results:
if results[key]['page'] is not None:
results[key]['page'] = str(int(results[key]['page'])+6)
results[key]['page'] = str(int(results[key]['page']) + 6)
for key in results:
if results[key]['page'] is not None:
results[key]['page'] = 'page_' + str(int(results[key]['page'])+1)
results[key]['page'] = 'page_' + str(int(results[key]['page']) + 1)
return results
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!