7967d700 by 周伟奇

one card

1 parent fae49be8
......@@ -29,6 +29,7 @@ def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, has
ocr_res_str = ocr_res_dict.get(ocr_field)
if ocr_res_str is not None:
ocr_res_list = json.loads(ocr_res_str)
length = len(ocr_res_list)
# 过期期限特殊处理
if has_expiry_date:
......@@ -49,7 +50,7 @@ def field_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_set, has
compare_res, ocr_output = getattr(cp, compare_tuple[2])(
input_str, ocr_str, idx, **compare_tuple[3])
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))
if idx == 0 and compare_res in [consts.RESULT_N, consts.RESULT_NA]:
if idx == 0 and compare_res in [consts.RESULT_N, consts.RESULT_NA] and length > 1:
break
is_find = True
......@@ -87,6 +88,8 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s
ocr_res_str = ocr_res_dict.get(ocr_field)
if ocr_res_str is not None:
ocr_res_list = json.loads(ocr_res_str)
length = len(ocr_res_list)
for ocr_res in ocr_res_list:
if is_find:
break
......@@ -99,6 +102,7 @@ def usedcar_info_compare(info_dict, ocr_res_dict, ocr_field, compare_list, res_s
if idx == 0 and compare_res in [consts.RESULT_N, consts.RESULT_NA]:
if ocr_str is not None:
no_match_vino.append(ocr_str)
if length > 1:
break
is_find = True
info_dict[compare_tuple[4]] = compare_res
......
......@@ -102,10 +102,7 @@ class Comparison:
if not isinstance(input_str, str) or not isinstance(ocr_str, str):
return self.RESULT_NA, None
if ocr_str == '':
if input_str == '0.0':
return self.RESULT_Y, input_str
else:
return self.RESULT_N, '0.0'
return self.RESULT_NA, None
try:
input_rmb_upper = to_rmb_upper(float(input_str))
res = self.build_res(input_rmb_upper == ocr_str)
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!