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
614fdf38
authored
2020-11-10 22:11:21 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
7c50d819
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/ocr/wb.py
src/apps/doc/consts.py
View file @
614fdf3
...
...
@@ -79,7 +79,7 @@ TRANS_MAP = {
TRANS
=
str
.
maketrans
(
TRANS_MAP
)
ERROR_CHARS
=
{
'.'
,
'。'
,
':'
,
':'
,
'•'
,
'·'
,
','
,
','
}
RES_SHEET_NAME
=
'结果统计'
RES_SHEET_HEADER
=
(
'页码'
,
'序号'
,
'结果'
)
RES_SHEET_HEADER
=
(
'页码'
,
'
图片序号'
,
'检测图片
序号'
,
'结果'
)
RES_SUCCESS
=
'识别成功'
RES_SUCCESS_OTHER
=
'识别成功(其他类)'
RES_SUCCESS_EMPTY
=
'识别成功(空数据)'
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
614fdf3
...
...
@@ -108,7 +108,7 @@ class Command(BaseCommand, LoggerMixin):
res_list
.
append
((
pno
,
ino
,
part_idx
,
consts
.
RES_SUCCESS_EMPTY
))
return
# confidence = ocr_data.get('confidence', 1)
img_name
=
'page_{0}_img_{1}
'
.
format
(
pno
,
ino
)
img_name
=
'page_{0}_img_{1}
_{2}'
.
format
(
pno
,
ino
,
part_idx
)
cells_exists
=
False
for
i
,
sheet
in
enumerate
(
sheets
):
cells
=
sheet
.
get
(
'cells'
)
...
...
src/apps/doc/ocr/wb.py
View file @
614fdf3
...
...
@@ -391,13 +391,14 @@ class BSWorkbook(Workbook):
amount_fill_row
=
set
()
for
rows
in
new_ws
.
iter_rows
(
min_row
=
2
):
summary_cell
=
None
if
summary_cell_idx
is
None
else
rows
[
summary_cell_idx
]
date_cell
=
None
if
date_cell_idx
is
None
else
rows
[
date_cell_idx
]
amount_cell
=
None
if
amount_cell_idx
is
None
else
rows
[
amount_cell_idx
]
over_cell
=
None
if
over_cell_idx
is
None
else
rows
[
over_cell_idx
]
income_cell
=
None
if
income_cell_idx
is
None
else
rows
[
income_cell_idx
]
outlay_cell
=
None
if
outlay_cell_idx
is
None
else
rows
[
outlay_cell_idx
]
borrow_cell
=
None
if
borrow_cell_idx
is
None
else
rows
[
borrow_cell_idx
]
length
=
len
(
rows
)
summary_cell
=
None
if
summary_cell_idx
is
None
or
summary_cell_idx
>=
length
else
rows
[
summary_cell_idx
]
date_cell
=
None
if
date_cell_idx
is
None
or
date_cell_idx
>=
length
else
rows
[
date_cell_idx
]
amount_cell
=
None
if
amount_cell_idx
is
None
or
amount_cell_idx
>=
length
else
rows
[
amount_cell_idx
]
over_cell
=
None
if
over_cell_idx
is
None
or
over_cell_idx
>=
length
else
rows
[
over_cell_idx
]
income_cell
=
None
if
income_cell_idx
is
None
or
income_cell_idx
>=
length
else
rows
[
income_cell_idx
]
outlay_cell
=
None
if
outlay_cell_idx
is
None
or
outlay_cell_idx
>=
length
else
rows
[
outlay_cell_idx
]
borrow_cell
=
None
if
borrow_cell_idx
is
None
or
borrow_cell_idx
>=
length
else
rows
[
borrow_cell_idx
]
summary_cell_value
=
None
if
summary_cell
is
None
else
summary_cell
.
value
date_cell_value
=
None
if
date_cell
is
None
else
date_cell
.
value
...
...
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