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
15ebcd41
authored
2020-11-12 14:33:18 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix bug
1 parent
6938253e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
src/apps/doc/ocr/wb.py
src/apps/doc/ocr/wb.py
View file @
15ebcd4
...
...
@@ -79,18 +79,24 @@ class BSWorkbook(Workbook):
# }
# 第一行关键词
find_count
=
0
header_col_list
=
[]
for
first_row
in
ws
.
iter_rows
(
max_row
=
1
,
min_row
=
1
,
values_only
=
True
):
sheet_header_info
.
setdefault
(
ws
.
title
,
{})
.
setdefault
(
consts
.
HEADER_KEY
,
first_row
)
for
idx
,
header_value
in
enumerate
(
first_row
):
header_col
=
self
.
get_header_col
(
header_value
,
classify
)
if
header_col
is
not
None
:
find_count
+=
1
sheet_header_info
.
setdefault
(
ws
.
title
,
{})
.
setdefault
(
header_col
,
idx
)
find_col_set
=
sheet_header_info
.
setdefault
(
ws
.
title
,
{})
.
setdefault
(
consts
.
FIND_COL_KEY
,
set
())
find_col_set
.
add
(
idx
)
col_count
=
header_info
.
setdefault
(
header_col
,
{})
.
get
(
idx
)
header_info
.
setdefault
(
header_col
,
{})[
idx
]
=
1
if
col_count
is
None
else
col_count
+
1
header_col_list
.
append
((
idx
,
header_col
))
find_count
=
len
(
header_col_list
)
if
find_count
<
2
:
find_count
=
0
else
:
for
idx
,
header_col
in
header_col_list
:
sheet_header_info
.
setdefault
(
ws
.
title
,
{})
.
setdefault
(
header_col
,
idx
)
find_col_set
=
sheet_header_info
.
setdefault
(
ws
.
title
,
{})
.
setdefault
(
consts
.
FIND_COL_KEY
,
set
())
find_col_set
.
add
(
idx
)
col_count
=
header_info
.
setdefault
(
header_col
,
{})
.
get
(
idx
)
header_info
.
setdefault
(
header_col
,
{})[
idx
]
=
1
if
col_count
is
None
else
col_count
+
1
sheet_header_info
.
setdefault
(
ws
.
title
,
{})
.
setdefault
(
consts
.
FIND_COUNT_KEY
,
find_count
)
min_row
=
1
if
find_count
==
0
else
2
...
...
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