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
789f8e25
authored
2020-12-09 17:29:21 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix sheet name char
1 parent
91571bac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
src/apps/doc/consts.py
src/apps/doc/ocr/wb.py
src/apps/doc/consts.py
View file @
789f8e2
...
...
@@ -79,6 +79,16 @@ TRANS_MAP = {
'B'
:
"13"
,
}
TRANS
=
str
.
maketrans
(
TRANS_MAP
)
SHEET_TITLE_TRANS_MAP
=
{
'/'
:
""
,
'
\\
'
:
""
,
'?'
:
""
,
'*'
:
""
,
'['
:
""
,
']'
:
""
,
}
SHEET_TITLE_TRANS
=
str
.
maketrans
(
SHEET_TITLE_TRANS_MAP
)
ERROR_CARD
=
'异常卡号'
ERROR_CHARS
=
{
'.'
,
'。'
,
':'
,
':'
,
'•'
,
'·'
,
','
,
','
}
RES_SHEET_NAME
=
'结果统计'
RES_SHEET_HEADER
=
(
'页码'
,
'图片序号'
,
'检测图片序号'
,
'结果'
)
...
...
src/apps/doc/ocr/wb.py
View file @
789f8e2
...
...
@@ -40,6 +40,18 @@ class BSWorkbook(Workbook):
return
new_set
@staticmethod
def
get_new_card
(
card
):
if
not
isinstance
(
card
,
str
):
return
consts
.
ERROR_CARD
try
:
new_card
=
card
.
translate
(
consts
.
SHEET_TITLE_TRANS
)
.
strip
()[
-
6
:]
if
len
(
new_card
)
==
0
:
new_card
=
consts
.
ERROR_CARD
except
Exception
as
e
:
new_card
=
consts
.
ERROR_CARD
return
new_card
@staticmethod
def
get_header_col
(
header_value
,
classify
):
if
header_value
is
None
:
return
...
...
@@ -540,10 +552,7 @@ class BSWorkbook(Workbook):
# }
# }
for
card
,
summary
in
bs_summary
.
items
():
try
:
new_card
=
card
[
-
6
:]
.
replace
(
'*'
,
''
)
except
Exception
as
e
:
new_card
=
'异常卡号'
new_card
=
self
.
get_new_card
(
card
)
# 1.原表表头收集、按照月份分割
# 1.1 总结首行信息
classify
=
summary
.
get
(
'classify'
,
0
)
...
...
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