725a8e62 by 周伟奇

fix bug

1 parent b198d2cf
......@@ -67,16 +67,20 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s
break
for idx, compare_tuple in enumerate(compare_list):
input_str = info_dict.get(compare_tuple[0])
ocr_str = ocr_res.get(compare_tuple[1], '')
compare_res = getattr(cp, compare_tuple[2])(
ocr_str = ocr_res.get(compare_tuple[1])
compare_res, ocr_output = getattr(cp, compare_tuple[2])(
info_dict.get(compare_tuple[0]), ocr_res.get(compare_tuple[1]), idx, **compare_tuple[3])
if idx == 0 and compare_res == consts.RESULT_N:
no_match_vino.append(ocr_str)
if ocr_str is not None:
no_match_vino.append(ocr_str)
break
is_find = True
info_dict[compare_tuple[4]] = compare_res
if input_str is not None:
info_dict[compare_tuple[0]] = ocr_str
if ocr_str is None or ocr_output is None:
del info_dict[compare_tuple[0]]
else:
info_dict[compare_tuple[0]] = ocr_output
res_set.add(compare_res)
if not is_find:
res_set.add(consts.RESULT_N)
......
......@@ -82,9 +82,13 @@ class Comparison:
def rmb_compare(self, input_str, ocr_str, idx, **kwargs):
if not isinstance(input_str, str) or not isinstance(ocr_str, str):
return self.RESULT_N
return self.RESULT_N, None
input_rmb_upper = to_rmb_upper(float(input_str))
return self.build_res(input_rmb_upper == ocr_str), input_str
res = self.build_res(input_rmb_upper == ocr_str)
if res == self.RESULT_Y:
return res, input_str
else:
return res, None
def type_compare(self, input_str, ocr_str, idx, **kwargs):
if not isinstance(input_str, str) or not isinstance(ocr_str, str):
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!