fix bug
Showing
1 changed file
with
5 additions
and
5 deletions
... | @@ -34,12 +34,12 @@ class Comparison: | ... | @@ -34,12 +34,12 @@ class Comparison: |
34 | return self.RESULT_N | 34 | return self.RESULT_N |
35 | 35 | ||
36 | def common_compare(self, input_str, ocr_str, **kwargs): | 36 | def common_compare(self, input_str, ocr_str, **kwargs): |
37 | if not isinstance(input_str, str) or isinstance(ocr_str, str): | 37 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): |
38 | return self.RESULT_N | 38 | return self.RESULT_N |
39 | return self.build_res(input_str == ocr_str) | 39 | return self.build_res(input_str == ocr_str) |
40 | 40 | ||
41 | def name_compare(self, input_str, ocr_str, **kwargs): | 41 | def name_compare(self, input_str, ocr_str, **kwargs): |
42 | if not isinstance(input_str, str) or isinstance(ocr_str, str): | 42 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): |
43 | return self.RESULT_N | 43 | return self.RESULT_N |
44 | if kwargs.get('is_passport'): | 44 | if kwargs.get('is_passport'): |
45 | input_obj = re.search(r'[a-zA-Z]]!', input_str) | 45 | input_obj = re.search(r'[a-zA-Z]]!', input_str) |
... | @@ -60,7 +60,7 @@ class Comparison: | ... | @@ -60,7 +60,7 @@ class Comparison: |
60 | return self.build_res(input_s == ocr_s) | 60 | return self.build_res(input_s == ocr_s) |
61 | 61 | ||
62 | def date_compare(self, input_str, ocr_str, **kwargs): | 62 | def date_compare(self, input_str, ocr_str, **kwargs): |
63 | if not isinstance(input_str, str) or isinstance(ocr_str, str): | 63 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): |
64 | return self.RESULT_N | 64 | return self.RESULT_N |
65 | if kwargs.get('long', False) and '长期' in ocr_str: | 65 | if kwargs.get('long', False) and '长期' in ocr_str: |
66 | return '2099-12-31' | 66 | return '2099-12-31' |
... | @@ -73,13 +73,13 @@ class Comparison: | ... | @@ -73,13 +73,13 @@ class Comparison: |
73 | return self.build_res(input_str == ocr_str) | 73 | return self.build_res(input_str == ocr_str) |
74 | 74 | ||
75 | def rmb_compare(self, input_str, ocr_str, **kwargs): | 75 | def rmb_compare(self, input_str, ocr_str, **kwargs): |
76 | if not isinstance(input_str, str) or isinstance(ocr_str, str): | 76 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): |
77 | return self.RESULT_N | 77 | return self.RESULT_N |
78 | input_rmb_upper = to_rmb_upper(float(input_str)) | 78 | input_rmb_upper = to_rmb_upper(float(input_str)) |
79 | return self.build_res(input_rmb_upper == ocr_str) | 79 | return self.build_res(input_rmb_upper == ocr_str) |
80 | 80 | ||
81 | def type_compare(self, input_str, ocr_str, **kwargs): | 81 | def type_compare(self, input_str, ocr_str, **kwargs): |
82 | if not isinstance(input_str, str) or isinstance(ocr_str, str): | 82 | if not isinstance(input_str, str) or not isinstance(ocr_str, str): |
83 | return self.RESULT_N | 83 | return self.RESULT_N |
84 | for map_tuple in self.TYPE_MAPPING: | 84 | for map_tuple in self.TYPE_MAPPING: |
85 | if re.search(map_tuple[0], ocr_str) is not None: | 85 | if re.search(map_tuple[0], ocr_str) is not None: | ... | ... |
-
Please register or sign in to post a comment