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
79e91f0b
authored
2021-12-16 16:04:09 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix hil e-contract
1 parent
de9a84b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
1 deletions
src/common/electronic_hil_contract/get_char.py
src/common/electronic_hil_contract/get_char.py
View file @
79e91f0
...
...
@@ -73,6 +73,8 @@ class Finder:
"合同编号(正文)"
:
self
.
item
,
"抵押人姓名/名称"
:
self
.
item
,
"抵押人证件号码"
:
self
.
item
,
"抵押人配偶姓名/名称"
:
self
.
item
,
"抵押人配偶证件号码"
:
self
.
item
,
"车辆识别代码"
:
self
.
item
,
"租金总额"
:
self
.
item
,
"融资租赁期限"
:
self
.
item
,
...
...
@@ -451,12 +453,15 @@ class Finder:
page
=
pno
table
=
True
# print("repayment_schedule_text_list = ", repayment_schedule_text_list)
repayment_schedule_table
=
[[
'序号'
,
'融资租赁成本'
,
'融资租赁费用'
,
'租金'
,
'剩余融资租赁成本'
]]
# repayment_schedule_table = [['序号', '融资租赁成本', '融资租赁费用', '租金', '剩余融资租赁成本']]
repayment_schedule_table
=
[[
'序号'
,
'租金'
]]
for
i
in
range
(
len
(
repayment_schedule_text_list
)
//
4
):
line
=
[
f
'{i + 1}.'
]
# 4表示4列的意思
for
j
in
range
(
4
):
line
.
append
(
repayment_schedule_text_list
[
i
*
4
+
j
])
# 只保留序号和租金列
line
=
[
line
[
0
]
.
replace
(
'.'
,
''
),
line
[
3
]]
repayment_schedule_table
.
append
(
line
)
repayment_schedule
[
'words'
]
=
repayment_schedule_table
repayment_schedule
[
'page'
]
=
page
...
...
@@ -865,6 +870,40 @@ class Finder:
_id
[
'words'
]
=
words
return
name
,
_id
def
get_dyrpo_name_id
(
self
):
name
=
self
.
item
.
copy
()
_id
=
self
.
item
.
copy
()
key_box
=
None
for
pno
in
self
.
pdf_info
:
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
text
==
'抵押人配偶(如适'
:
key_box
=
bbox
if
key_box
is
not
None
:
rh
=
abs
(
key_box
[
1
]
-
key_box
[
3
])
for
pno
in
self
.
pdf_info
:
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
key_box
[
1
]
<
np
.
mean
(
bbox
[
1
::
2
])
<
key_box
[
3
]
+
rh
*
3
and
'姓名'
in
text
:
words
=
text
.
split
(
':'
)[
-
1
]
name
[
'position'
]
=
bbox
name
[
'page'
]
=
pno
name
[
'words'
]
=
words
if
key_box
[
1
]
<
np
.
mean
(
bbox
[
1
::
2
])
<
key_box
[
3
]
+
rh
*
3
and
'证件号码'
in
text
:
words
=
text
.
split
(
':'
)[
-
1
]
_id
[
'position'
]
=
bbox
_id
[
'page'
]
=
pno
_id
[
'words'
]
=
words
return
name
,
_id
def
get_key_value_position
(
self
,
key
):
value
=
self
.
item
.
copy
()
key_box
=
None
...
...
@@ -1153,6 +1192,10 @@ class Finder:
name
,
_id
=
self
.
get_dyr_name_id
()
self
.
init_result_2
[
'抵押人姓名/名称'
]
=
name
self
.
init_result_2
[
'抵押人证件号码'
]
=
_id
# 抵押人配偶信息
name
,
_id
=
self
.
get_dyrpo_name_id
()
self
.
init_result_2
[
'抵押人配偶姓名/名称'
]
=
name
self
.
init_result_2
[
'抵押人配偶证件号码'
]
=
_id
# 车辆识别代码
vin
=
self
.
get_key_value
(
key
=
'车辆识别代码:'
)
self
.
init_result_2
[
'车辆识别代码'
]
=
vin
...
...
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