Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pdf-miner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Qin Kaijie
pdf-miner
Commits
154eed1a
Commit
154eed1a
authored
Mar 26, 2024
by
赵小蒙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
footnote drop逻辑更新
parent
b7652171
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
ocr_span_list_modify.py
magic_pdf/pre_proc/ocr_span_list_modify.py
+5
-0
No files found.
magic_pdf/pre_proc/ocr_span_list_modify.py
View file @
154eed1a
...
...
@@ -44,10 +44,15 @@ def remove_spans_by_bboxes_dict(spans, need_remove_spans_bboxes_dict):
# logger.info(f"remove spans by bbox dict, drop_tag: {drop_tag}, removed_bboxes: {removed_bboxes}")
need_remove_spans
=
[]
for
span
in
spans
:
# 通过判断span的bbox是否在removed_bboxes中, 判断是否需要删除该span
for
removed_bbox
in
removed_bboxes
:
if
calculate_overlap_area_in_bbox1_area_ratio
(
span
[
'bbox'
],
removed_bbox
)
>
0.5
:
need_remove_spans
.
append
(
span
)
break
# 当drop_tag为DropTag.FOOTNOTE时, 判断span是否在removed_bboxes中任意一个的下方,如果是,则删除该span
elif
drop_tag
==
DropTag
.
FOOTNOTE
and
(
span
[
'bbox'
][
1
]
+
span
[
'bbox'
][
3
])
/
2
>
removed_bbox
[
3
]
and
removed_bbox
[
0
]
<
(
span
[
'bbox'
][
0
]
+
span
[
'bbox'
][
2
])
/
2
<
removed_bbox
[
2
]:
need_remove_spans
.
append
(
span
)
break
for
span
in
need_remove_spans
:
spans
.
remove
(
span
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment