Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
MinerU
Commits
154eed1a
Commit
154eed1a
authored
Mar 26, 2024
by
赵小蒙
Browse files
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
magic_pdf/pre_proc/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