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
3690e26d
authored
2022-10-31 16:53:40 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix hil e-contract
1 parent
01d81417
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
src/common/electronic_hil_contract/get_char.py
src/common/electronic_hil_contract/get_char.py
View file @
3690e26
...
...
@@ -1101,6 +1101,31 @@ class Finder:
representative
[
'position'
]
=
bbox
return
name
,
id_num
,
representative
def
get_value_by_findall
(
self
,
prefix
,
suffix
,
page_num
):
value
=
self
.
item
.
copy
()
all_text
=
''
pno
=
page_num
for
block
in
self
.
pdf_info
[
pno
][
'blocks'
]:
if
block
[
'type'
]
!=
0
:
continue
for
line
in
block
[
'lines'
]:
for
span
in
line
[
'spans'
]:
bbox
,
text
=
span
[
'bbox'
],
span
[
'text'
]
all_text
+=
text
words_list
=
re
.
findall
(
f
"{prefix}(.*?){suffix}"
,
all_text
)
if
len
(
words_list
)
>
0
:
for
block
in
self
.
pdf_info
[
pno
][
'blocks'
]:
if
block
[
'type'
]
!=
0
:
continue
for
line
in
block
[
'lines'
]:
for
span
in
line
[
'spans'
]:
bbox
,
text
=
span
[
'bbox'
],
span
[
'text'
]
if
words_list
[
0
]
in
text
:
value
[
'position'
]
=
bbox
value
[
'page'
]
=
pno
value
[
'words'
]
=
words_list
[
0
]
return
value
def
get_info
(
self
):
"""
block['type'] == 0 : 表示该元素为图片
...
...
@@ -1281,6 +1306,8 @@ class Finder:
self
.
init_result_1
[
'承租人-证件号码'
]
=
_id
# 销售经销商
seller
=
self
.
get_key_value
(
key
=
'销售经销商:'
,
page_num
=
'0'
)
if
seller
[
'words'
]
==
""
:
seller
=
self
.
get_value_by_findall
(
'销售经销商:'
,
'地址:'
,
page_num
=
'0'
)
self
.
init_result_1
[
'销售经销商'
]
=
seller
# 合同编号(正文)
contract_no
=
self
.
get_contract_no_one
()
...
...
@@ -1296,6 +1323,9 @@ class Finder:
self
.
init_result_1
[
'签字页-承租人签章'
]
=
signature_role_1
# 签字页-销售经销商
seller
=
self
.
get_key_value
(
key
=
'销售经销商:'
)
if
seller
[
'words'
]
==
""
:
# 销售经销商:深圳市宝创汽车贸易有限公司南山分公司(请授权代表签字并请盖章)
seller
=
self
.
get_value_by_findall
(
'销售经销商:'
,
'(请授权代表签字并请盖章)'
,
page_num
=
'3'
)
self
.
init_result_1
[
'签字页-销售经销商'
]
=
seller
# 经销商签章
pass
...
...
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