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
f5ed232c
authored
2020-11-09 22:45:12 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
939cde2e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
src/apps/doc/consts.py
src/apps/doc/ocr/wb.py
src/apps/doc/consts.py
View file @
f5ed232
...
...
@@ -896,6 +896,7 @@ OTHER_CLASSIFY_SET = {OTHER_CLASSIFY}
LICENSE_CLASSIFY_SET_1
=
{
IC_CLASSIFY
,
VAT_CLASSIFY
,
MVC_CLASSIFY
,
MVI_CLASSIFY
}
LICENSE_CLASSIFY_SET_2
=
{
BL_CLASSIFY
,
UCI_CLASSIFY
,
EEP_CLASSIFY
,
DL_CLASSIFY
,
PP_CLASSIFY
,
BC_CLASSIFY
}
MS_CLASSIFY
=
21
WECHART_CLASSIFY
=
12
WECHART_HEADERS_MAPPING
=
copy
.
deepcopy
(
HEADERS_MAPPING
)
WECHART_HEADERS_MAPPING
.
update
(
...
...
src/apps/doc/ocr/wb.py
View file @
f5ed232
...
...
@@ -312,14 +312,16 @@ class BSWorkbook(Workbook):
return
res_str
@staticmethod
def
wechart_func
(
row_value
):
def
wechart_func
(
row_value
,
pre_col
,
next_col
):
row_value
=
list
(
row_value
)
if
isinstance
(
row_value
[
1
],
str
):
cn_chars
=
re
.
findall
(
consts
.
CN_RE
,
row_value
[
1
])
if
isinstance
(
row_value
[
pre_col
],
str
):
cn_chars
=
re
.
findall
(
consts
.
CN_RE
,
row_value
[
pre_col
])
cn_str
=
''
.
join
(
cn_chars
)
row_value
[
1
]
=
re
.
sub
(
consts
.
CN_RE
,
''
,
row_value
[
1
])
if
isinstance
(
row_value
[
2
],
str
):
row_value
[
2
]
=
'{0}
\n
{1}'
.
format
(
cn_str
,
row_value
[
2
])
row_value
[
pre_col
]
=
re
.
sub
(
consts
.
CN_RE
,
''
,
row_value
[
pre_col
])
if
row_value
[
next_col
]
is
None
:
row_value
[
next_col
]
=
cn_str
elif
isinstance
(
row_value
[
next_col
],
str
):
row_value
[
next_col
]
=
'{0}
\n
{1}'
.
format
(
cn_str
,
row_value
[
next_col
])
return
row_value
def
build_month_sheet
(
self
,
ms
,
card
,
month_mapping
,
is_reverse
,
statistics_header_info
,
max_column
,
classify
):
...
...
@@ -355,7 +357,9 @@ class BSWorkbook(Workbook):
for
row_value
in
ws
.
iter_rows
(
min_row
=
part
[
1
],
max_row
=
part
[
2
],
values_only
=
True
):
if
any
(
row_value
):
if
classify
==
consts
.
WECHART_CLASSIFY
:
row_value
=
self
.
wechart_func
(
row_value
)
row_value
=
self
.
wechart_func
(
row_value
,
1
,
2
)
elif
classify
==
consts
.
MS_CLASSIFY
:
row_value
=
self
.
wechart_func
(
row_value
,
5
,
6
)
new_ws
.
append
(
row_value
)
# 3.2.提取信息、高亮
amount_mapping
=
{}
...
...
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