one card
Showing
2 changed files
with
6 additions
and
5 deletions
... | @@ -29,6 +29,7 @@ def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, has | ... | @@ -29,6 +29,7 @@ def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, has |
29 | ocr_res_str = ocr_res_dict.get(ocr_field) | 29 | ocr_res_str = ocr_res_dict.get(ocr_field) |
30 | if ocr_res_str is not None: | 30 | if ocr_res_str is not None: |
31 | ocr_res_list = json.loads(ocr_res_str) | 31 | ocr_res_list = json.loads(ocr_res_str) |
32 | length = len(ocr_res_list) | ||
32 | 33 | ||
33 | # 过期期限特殊处理 | 34 | # 过期期限特殊处理 |
34 | if has_expiry_date: | 35 | if has_expiry_date: |
... | @@ -49,7 +50,7 @@ def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, has | ... | @@ -49,7 +50,7 @@ def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, has |
49 | compare_res, ocr_output = getattr(cp, compare_tuple[2])( | 50 | compare_res, ocr_output = getattr(cp, compare_tuple[2])( |
50 | input_str, ocr_str, idx, **compare_tuple[3]) | 51 | input_str, ocr_str, idx, **compare_tuple[3]) |
51 | print('type: {0}, idx: {1}, field: {2}, input: {3}, ocr: {4}, res: {5}, out: {6}'.format(ocr_field, idx, compare_tuple[0], input_str, ocr_str, compare_res, ocr_output)) | 52 | print('type: {0}, idx: {1}, field: {2}, input: {3}, ocr: {4}, res: {5}, out: {6}'.format(ocr_field, idx, compare_tuple[0], input_str, ocr_str, compare_res, ocr_output)) |
52 | if idx == 0 and compare_res in [consts.RESULT_N, consts.RESULT_NA]: | 53 | if idx == 0 and compare_res in [consts.RESULT_N, consts.RESULT_NA] and length > 1: |
53 | break | 54 | break |
54 | is_find = True | 55 | is_find = True |
55 | 56 | ||
... | @@ -87,6 +88,8 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s | ... | @@ -87,6 +88,8 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s |
87 | ocr_res_str = ocr_res_dict.get(ocr_field) | 88 | ocr_res_str = ocr_res_dict.get(ocr_field) |
88 | if ocr_res_str is not None: | 89 | if ocr_res_str is not None: |
89 | ocr_res_list = json.loads(ocr_res_str) | 90 | ocr_res_list = json.loads(ocr_res_str) |
91 | length = len(ocr_res_list) | ||
92 | |||
90 | for ocr_res in ocr_res_list: | 93 | for ocr_res in ocr_res_list: |
91 | if is_find: | 94 | if is_find: |
92 | break | 95 | break |
... | @@ -99,6 +102,7 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s | ... | @@ -99,6 +102,7 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s |
99 | if idx == 0 and compare_res in [consts.RESULT_N, consts.RESULT_NA]: | 102 | if idx == 0 and compare_res in [consts.RESULT_N, consts.RESULT_NA]: |
100 | if ocr_str is not None: | 103 | if ocr_str is not None: |
101 | no_match_vino.append(ocr_str) | 104 | no_match_vino.append(ocr_str) |
105 | if length > 1: | ||
102 | break | 106 | break |
103 | is_find = True | 107 | is_find = True |
104 | info_dict[compare_tuple[4]] = compare_res | 108 | info_dict[compare_tuple[4]] = compare_res | ... | ... |
... | @@ -102,10 +102,7 @@ class Comparison: | ... | @@ -102,10 +102,7 @@ class Comparison: |
102 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): | 102 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): |
103 | return self.RESULT_NA, None | 103 | return self.RESULT_NA, None |
104 | if ocr_str == '': | 104 | if ocr_str == '': |
105 | if input_str == '0.0': | 105 | return self.RESULT_NA, None |
106 | return self.RESULT_Y, input_str | ||
107 | else: | ||
108 | return self.RESULT_N, '0.0' | ||
109 | try: | 106 | try: |
110 | input_rmb_upper = to_rmb_upper(float(input_str)) | 107 | input_rmb_upper = to_rmb_upper(float(input_str)) |
111 | res = self.build_res(input_rmb_upper == ocr_str) | 108 | res = self.build_res(input_rmb_upper == ocr_str) | ... | ... |
-
Please register or sign in to post a comment