Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
201ab38c
authored
2021-03-30 17:13:25 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
b456b296
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
src/common/tools/comparison.py
src/common/tools/comparison.py
View file @
201ab38
...
...
@@ -34,12 +34,12 @@ class Comparison:
return
self
.
RESULT_N
def
common_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
not
isinstance
(
input_str
,
str
)
or
isinstance
(
ocr_str
,
str
):
if
not
isinstance
(
input_str
,
str
)
or
not
isinstance
(
ocr_str
,
str
):
return
self
.
RESULT_N
return
self
.
build_res
(
input_str
==
ocr_str
)
def
name_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
not
isinstance
(
input_str
,
str
)
or
isinstance
(
ocr_str
,
str
):
if
not
isinstance
(
input_str
,
str
)
or
not
isinstance
(
ocr_str
,
str
):
return
self
.
RESULT_N
if
kwargs
.
get
(
'is_passport'
):
input_obj
=
re
.
search
(
r'[a-zA-Z]]!'
,
input_str
)
...
...
@@ -60,7 +60,7 @@ class Comparison:
return
self
.
build_res
(
input_s
==
ocr_s
)
def
date_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
not
isinstance
(
input_str
,
str
)
or
isinstance
(
ocr_str
,
str
):
if
not
isinstance
(
input_str
,
str
)
or
not
isinstance
(
ocr_str
,
str
):
return
self
.
RESULT_N
if
kwargs
.
get
(
'long'
,
False
)
and
'长期'
in
ocr_str
:
return
'2099-12-31'
...
...
@@ -73,13 +73,13 @@ class Comparison:
return
self
.
build_res
(
input_str
==
ocr_str
)
def
rmb_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
not
isinstance
(
input_str
,
str
)
or
isinstance
(
ocr_str
,
str
):
if
not
isinstance
(
input_str
,
str
)
or
not
isinstance
(
ocr_str
,
str
):
return
self
.
RESULT_N
input_rmb_upper
=
to_rmb_upper
(
float
(
input_str
))
return
self
.
build_res
(
input_rmb_upper
==
ocr_str
)
def
type_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
not
isinstance
(
input_str
,
str
)
or
isinstance
(
ocr_str
,
str
):
if
not
isinstance
(
input_str
,
str
)
or
not
isinstance
(
ocr_str
,
str
):
return
self
.
RESULT_N
for
map_tuple
in
self
.
TYPE_MAPPING
:
if
re
.
search
(
map_tuple
[
0
],
ocr_str
)
is
not
None
:
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment