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
c295587b
Unverified
Commit
c295587b
authored
Nov 28, 2024
by
Xiaomeng Zhao
Committed by
GitHub
Nov 28, 2024
Browse files
Merge pull request #1135 from myhloli/dev
feat(pdf_parse): filter out skewed text lines
parents
5ecafbfa
37da8c44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
magic_pdf/pdf_parse_union_core_v2.py
magic_pdf/pdf_parse_union_core_v2.py
+3
-1
No files found.
magic_pdf/pdf_parse_union_core_v2.py
View file @
c295587b
...
...
@@ -139,10 +139,12 @@ def txt_spans_extract_v2(pdf_page, spans, all_bboxes, all_discarded_blocks, lang
text_blocks_raw
=
pdf_page
.
get_text
(
'rawdict'
,
flags
=
fitz
.
TEXTFLAGS_TEXT
)[
'blocks'
]
# @todo: 拿到char之后把倾斜角度较大的先删一遍
all_pymu_chars
=
[]
for
block
in
text_blocks_raw
:
for
line
in
block
[
'lines'
]:
cosine
,
sine
=
line
[
'dir'
]
if
abs
(
cosine
)
<
0.9
or
abs
(
sine
)
>
0.1
:
continue
for
span
in
line
[
'spans'
]:
all_pymu_chars
.
extend
(
span
[
'chars'
])
...
...
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