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
c39b3051
authored
2021-07-23 15:33:38 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add rebuild result
1 parent
e9bc46f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
src/apps/doc/management/commands/folder_ocr_process.py
src/apps/doc/ocr/wb.py
src/apps/doc/management/commands/folder_ocr_process.py
View file @
c39b305
...
...
@@ -255,7 +255,7 @@ class Command(BaseCommand, LoggerMixin):
result_dict
=
ocr_res
.
get
(
'data'
,
{})
wb
=
BSWorkbook
(
set
(),
set
(),
set
(),
set
(),
set
())
wb
.
ltgt_build
(
label
,
result_dict
)
rebuild_res
=
wb
.
ltgt_build
(
label
,
result_dict
)
wb
.
remove_base_sheet
()
wb
.
save
(
excel_path
)
except
Exception
as
e
:
...
...
src/apps/doc/ocr/wb.py
View file @
c39b305
...
...
@@ -704,21 +704,28 @@ class BSWorkbook(Workbook):
def
ltgt_build
(
self
,
label
,
result_dict
):
ws
=
self
.
create_sheet
(
label
)
rebuild_res
=
{}
for
key
,
value
in
result_dict
.
items
():
if
isinstance
(
value
,
list
):
value_list
=
[
dict_item
.
get
(
'words'
)
for
dict_item
in
value
]
ws
.
append
((
key
,
*
value_list
))
ws
.
append
((
key
,
'、'
.
join
(
value_list
)))
rebuild_res
[
key
]
=
'、'
.
join
(
value_list
)
elif
isinstance
(
value
,
dict
):
if
'words'
in
value
:
ws
.
append
((
key
,
value
[
'words'
]))
rebuild_res
[
key
]
=
value
[
'words'
]
else
:
for
sub_key
,
sub_value
in
value
.
items
():
if
isinstance
(
sub_value
,
dict
):
ws
.
append
((
'{0}: {1}'
.
format
(
key
,
sub_key
),
sub_value
.
get
(
'words'
,
''
)))
rebuild_res
[
'{0}: {1}'
.
format
(
key
,
sub_key
)]
=
sub_value
.
get
(
'words'
,
''
)
else
:
ws
.
append
((
'{0}: {1}'
.
format
(
key
,
sub_key
),
sub_value
))
rebuild_res
[
'{0}: {1}'
.
format
(
key
,
sub_key
)]
=
sub_value
else
:
ws
.
append
((
key
,
value
))
rebuild_res
[
key
]
=
value
return
rebuild_res
def
simple_license_rebuild
(
self
,
license_summary
,
document_scheme
):
# for ic_license_dict in license_summary.get(consts.IC_CLASSIFY, []):
...
...
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