fix HIL contract
Showing
2 changed files
with
5 additions
and
12 deletions
This diff is collapsed.
Click to expand it.
... | @@ -10,15 +10,14 @@ from .get_char import Finder | ... | @@ -10,15 +10,14 @@ from .get_char import Finder |
10 | 10 | ||
11 | def predict(pdf_info, file_cls): | 11 | def predict(pdf_info, file_cls): |
12 | """Summary | 12 | """Summary |
13 | 13 | ||
14 | Args: | 14 | Args: |
15 | pdf_info (TYPE): Description | 15 | pdf_info (TYPE): Description |
16 | file_cls (TYPE): file_cls = 0: 售后回租合同; file_cls = 1: 车辆处置协议; file_cls = 2: 车辆租赁抵押合同 | 16 | file_cls (TYPE): file_cls = 0: 售后回租合同; file_cls = 1: 车辆处置协议; file_cls = 2: 车辆租赁抵押合同 |
17 | 17 | ||
18 | Returns: | 18 | Returns: |
19 | TYPE: Description | 19 | TYPE: Description |
20 | """ | 20 | """ |
21 | |||
22 | # 0: 售后回租合同 | 21 | # 0: 售后回租合同 |
23 | pdf_info_0 = [] | 22 | pdf_info_0 = [] |
24 | for pno in pdf_info: | 23 | for pno in pdf_info: |
... | @@ -30,7 +29,6 @@ def predict(pdf_info, file_cls): | ... | @@ -30,7 +29,6 @@ def predict(pdf_info, file_cls): |
30 | bbox, text = span['bbox'], span['text'] | 29 | bbox, text = span['bbox'], span['text'] |
31 | if '售后回租合同_' in text: | 30 | if '售后回租合同_' in text: |
32 | pdf_info_0.append(pdf_info[pno]) | 31 | pdf_info_0.append(pdf_info[pno]) |
33 | |||
34 | # 1: 车辆处置协议 | 32 | # 1: 车辆处置协议 |
35 | pdf_info_1 = [] | 33 | pdf_info_1 = [] |
36 | for pno in pdf_info: | 34 | for pno in pdf_info: |
... | @@ -42,7 +40,6 @@ def predict(pdf_info, file_cls): | ... | @@ -42,7 +40,6 @@ def predict(pdf_info, file_cls): |
42 | bbox, text = span['bbox'], span['text'] | 40 | bbox, text = span['bbox'], span['text'] |
43 | if '售后回租合同附件一' in text: | 41 | if '售后回租合同附件一' in text: |
44 | pdf_info_1.append(pdf_info[pno]) | 42 | pdf_info_1.append(pdf_info[pno]) |
45 | |||
46 | # 2: 车辆租赁抵押合同 | 43 | # 2: 车辆租赁抵押合同 |
47 | pdf_info_2 = [] | 44 | pdf_info_2 = [] |
48 | for pno in pdf_info: | 45 | for pno in pdf_info: |
... | @@ -54,7 +51,6 @@ def predict(pdf_info, file_cls): | ... | @@ -54,7 +51,6 @@ def predict(pdf_info, file_cls): |
54 | bbox, text = span['bbox'], span['text'] | 51 | bbox, text = span['bbox'], span['text'] |
55 | if '车辆租赁抵押合同_' in text: | 52 | if '车辆租赁抵押合同_' in text: |
56 | pdf_info_2.append(pdf_info[pno]) | 53 | pdf_info_2.append(pdf_info[pno]) |
57 | |||
58 | is_clczxy = False | 54 | is_clczxy = False |
59 | # 如果 pdf_info_1 == 4 页,则说明此时输入包含了车辆处置协议 | 55 | # 如果 pdf_info_1 == 4 页,则说明此时输入包含了车辆处置协议 |
60 | if len(pdf_info_1) == 4 and file_cls == 1 and len(pdf_info_0) != 0: | 56 | 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): | ... | @@ -62,7 +58,6 @@ def predict(pdf_info, file_cls): |
62 | pdf_info = dict() | 58 | pdf_info = dict() |
63 | for pno, page_info in enumerate(pdf_info_1): | 59 | for pno, page_info in enumerate(pdf_info_1): |
64 | pdf_info[str(pno)] = page_info | 60 | pdf_info[str(pno)] = page_info |
65 | |||
66 | f = Finder(pdf_info) | 61 | f = Finder(pdf_info) |
67 | if file_cls == 0: | 62 | if file_cls == 0: |
68 | results = f.get_info() | 63 | results = f.get_info() |
... | @@ -72,13 +67,11 @@ def predict(pdf_info, file_cls): | ... | @@ -72,13 +67,11 @@ def predict(pdf_info, file_cls): |
72 | if file_cls == 2: | 67 | if file_cls == 2: |
73 | # 提取信息 ———— 车辆租赁抵押合同 | 68 | # 提取信息 ———— 车辆租赁抵押合同 |
74 | results = f.get_info_2() | 69 | results = f.get_info_2() |
75 | 70 | if is_clczxy is True: | |
76 | if is_clczxy == True: | ||
77 | for key in results: | 71 | for key in results: |
78 | if results[key]['page'] is not None: | 72 | if results[key]['page'] is not None: |
79 | results[key]['page'] = str(int(results[key]['page'])+6) | 73 | results[key]['page'] = str(int(results[key]['page']) + 6) |
80 | |||
81 | for key in results: | 74 | for key in results: |
82 | if results[key]['page'] is not None: | 75 | if results[key]['page'] is not None: |
83 | results[key]['page'] = 'page_' + str(int(results[key]['page'])+1) | 76 | results[key]['page'] = 'page_' + str(int(results[key]['page']) + 1) |
84 | return results | 77 | return results | ... | ... |
-
Please register or sign in to post a comment