fix bug
Showing
2 changed files
with
13 additions
and
5 deletions
... | @@ -67,16 +67,20 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s | ... | @@ -67,16 +67,20 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s |
67 | break | 67 | break |
68 | for idx, compare_tuple in enumerate(compare_list): | 68 | for idx, compare_tuple in enumerate(compare_list): |
69 | input_str = info_dict.get(compare_tuple[0]) | 69 | input_str = info_dict.get(compare_tuple[0]) |
70 | ocr_str = ocr_res.get(compare_tuple[1], '') | 70 | ocr_str = ocr_res.get(compare_tuple[1]) |
71 | compare_res = getattr(cp, compare_tuple[2])( | 71 | compare_res, ocr_output = getattr(cp, compare_tuple[2])( |
72 | info_dict.get(compare_tuple[0]), ocr_res.get(compare_tuple[1]), idx, **compare_tuple[3]) | 72 | info_dict.get(compare_tuple[0]), ocr_res.get(compare_tuple[1]), idx, **compare_tuple[3]) |
73 | if idx == 0 and compare_res == consts.RESULT_N: | 73 | if idx == 0 and compare_res == consts.RESULT_N: |
74 | if ocr_str is not None: | ||
74 | no_match_vino.append(ocr_str) | 75 | no_match_vino.append(ocr_str) |
75 | break | 76 | break |
76 | is_find = True | 77 | is_find = True |
77 | info_dict[compare_tuple[4]] = compare_res | 78 | info_dict[compare_tuple[4]] = compare_res |
78 | if input_str is not None: | 79 | if input_str is not None: |
79 | info_dict[compare_tuple[0]] = ocr_str | 80 | if ocr_str is None or ocr_output is None: |
81 | del info_dict[compare_tuple[0]] | ||
82 | else: | ||
83 | info_dict[compare_tuple[0]] = ocr_output | ||
80 | res_set.add(compare_res) | 84 | res_set.add(compare_res) |
81 | if not is_find: | 85 | if not is_find: |
82 | res_set.add(consts.RESULT_N) | 86 | res_set.add(consts.RESULT_N) | ... | ... |
... | @@ -82,9 +82,13 @@ class Comparison: | ... | @@ -82,9 +82,13 @@ class Comparison: |
82 | 82 | ||
83 | def rmb_compare(self, input_str, ocr_str, idx, **kwargs): | 83 | def rmb_compare(self, input_str, ocr_str, idx, **kwargs): |
84 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): | 84 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): |
85 | return self.RESULT_N | 85 | return self.RESULT_N, None |
86 | input_rmb_upper = to_rmb_upper(float(input_str)) | 86 | input_rmb_upper = to_rmb_upper(float(input_str)) |
87 | return self.build_res(input_rmb_upper == ocr_str), input_str | 87 | res = self.build_res(input_rmb_upper == ocr_str) |
88 | if res == self.RESULT_Y: | ||
89 | return res, input_str | ||
90 | else: | ||
91 | return res, None | ||
88 | 92 | ||
89 | def type_compare(self, input_str, ocr_str, idx, **kwargs): | 93 | def type_compare(self, input_str, ocr_str, idx, **kwargs): |
90 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): | 94 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): | ... | ... |
-
Please register or sign in to post a comment