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
4fad0d1f
authored
2021-07-21 19:28:43 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
add latigation
1 parent
ce86bdd5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
0 deletions
src/apps/doc/exceptions.py
src/apps/doc/management/commands/folder_ocr_process.py
src/apps/doc/ocr/wb.py
src/common/tools/pdf_to_img.py
src/apps/doc/exceptions.py
View file @
4fad0d1
...
...
@@ -13,6 +13,9 @@ class OCR2Exception(Exception):
class
OCR4Exception
(
Exception
):
pass
class
LTGTException
(
Exception
):
pass
class
GCAPException
(
Exception
):
pass
...
...
src/apps/doc/management/commands/folder_ocr_process.py
View file @
4fad0d1
This diff is collapsed.
Click to expand it.
src/apps/doc/ocr/wb.py
View file @
4fad0d1
...
...
@@ -702,6 +702,23 @@ class BSWorkbook(Workbook):
if
field_str
is
not
None
:
count_list
.
append
((
field_str
,
count
))
def
ltgt_build
(
self
,
label
,
result_dict
):
ws
=
self
.
create_sheet
(
label
)
for
key
,
value
in
result_dict
.
items
():
if
isinstance
(
value
,
list
):
ws
.
append
((
key
,
*
value
))
elif
isinstance
(
value
,
dict
):
if
'words'
in
value
:
ws
.
append
((
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'
,
''
)))
else
:
ws
.
append
((
'{0}: {1}'
.
format
(
key
,
sub_key
),
sub_value
))
else
:
ws
.
append
((
key
,
value
))
def
simple_license_rebuild
(
self
,
license_summary
,
document_scheme
):
# for ic_license_dict in license_summary.get(consts.IC_CLASSIFY, []):
# if ic_license_dict.get('类别') == '1':
...
...
src/common/tools/pdf_to_img.py
View file @
4fad0d1
...
...
@@ -225,3 +225,13 @@ class PDFHandler:
else
:
self
.
merge_il
(
pdf
,
pno
,
il
)
self
.
img_count
=
len
(
self
.
img_path_list
)
def
extract_page_image
(
self
):
self
.
img_path_list
=
[]
self
.
xref_set
=
set
()
os
.
makedirs
(
self
.
img_dir_path
,
exist_ok
=
True
)
with
fitz
.
Document
(
self
.
path
)
as
pdf
:
for
pno
in
range
(
pdf
.
pageCount
):
page
=
pdf
.
loadPage
(
pno
)
self
.
page_to_png
(
page
)
self
.
img_count
=
len
(
self
.
img_path_list
)
...
...
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