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
0b35b73c
"git@developer.sourcefind.cn:OpenDAS/torch-cluster.git" did not exist on "f0f2062f58571ad1e0636a484657650bf69f6a5c"
Commit
0b35b73c
authored
Mar 14, 2024
by
赵小蒙
Browse files
删除高度或者宽度为0的spans
parent
9bd6294b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
magic_pdf/pdf_parse_by_ocr.py
magic_pdf/pdf_parse_by_ocr.py
+6
-0
No files found.
magic_pdf/pdf_parse_by_ocr.py
View file @
0b35b73c
...
@@ -156,6 +156,9 @@ def parse_pdf_by_ocr(
...
@@ -156,6 +156,9 @@ def parse_pdf_by_ocr(
int
(
x1
/
horizontal_scale_ratio
),
int
(
x1
/
horizontal_scale_ratio
),
int
(
y1
/
vertical_scale_ratio
),
int
(
y1
/
vertical_scale_ratio
),
]
]
# 删除高度或者宽度为0的spans
if
bbox
[
2
]
-
bbox
[
0
]
==
0
or
bbox
[
3
]
-
bbox
[
1
]
==
0
:
continue
"""要删除的"""
"""要删除的"""
# 3: 'header', # 页眉
# 3: 'header', # 页眉
# 4: 'page number', # 页码
# 4: 'page number', # 页码
...
@@ -193,6 +196,9 @@ def parse_pdf_by_ocr(
...
@@ -193,6 +196,9 @@ def parse_pdf_by_ocr(
else
:
else
:
continue
continue
# 删除重叠spans中较小的那些
# 删除重叠spans中较小的那些
spans
=
remove_overlaps_min_spans
(
spans
)
spans
=
remove_overlaps_min_spans
(
spans
)
...
...
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