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
2c8470b0
Unverified
Commit
2c8470b0
authored
Mar 25, 2025
by
Xiaomeng Zhao
Committed by
GitHub
Mar 25, 2025
Browse files
Merge pull request #1986 from myhloli/dev
refactor(pdf_parse): adjust line calculation for block height
parents
26777d25
72e66c2d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
magic_pdf/pdf_parse_union_core_v2.py
magic_pdf/pdf_parse_union_core_v2.py
+2
-2
No files found.
magic_pdf/pdf_parse_union_core_v2.py
View file @
2c8470b0
...
@@ -457,7 +457,6 @@ def insert_lines_into_block(block_bbox, line_height, page_w, page_h):
...
@@ -457,7 +457,6 @@ def insert_lines_into_block(block_bbox, line_height, page_w, page_h):
# 如果block的宽度超过0.4页面宽度,则将block分成3行(是一种复杂布局,图不能切的太细)
# 如果block的宽度超过0.4页面宽度,则将block分成3行(是一种复杂布局,图不能切的太细)
if
block_weight
>
page_w
*
0.4
:
if
block_weight
>
page_w
*
0.4
:
lines
=
3
lines
=
3
line_height
=
(
y1
-
y0
)
/
lines
elif
block_weight
>
page_w
*
0.25
:
# (可能是三列结构,也切细点)
elif
block_weight
>
page_w
*
0.25
:
# (可能是三列结构,也切细点)
lines
=
int
(
block_height
/
line_height
)
lines
=
int
(
block_height
/
line_height
)
else
:
# 判断长宽比
else
:
# 判断长宽比
...
@@ -465,6 +464,7 @@ def insert_lines_into_block(block_bbox, line_height, page_w, page_h):
...
@@ -465,6 +464,7 @@ def insert_lines_into_block(block_bbox, line_height, page_w, page_h):
return
[[
x0
,
y0
,
x1
,
y1
]]
return
[[
x0
,
y0
,
x1
,
y1
]]
else
:
# 不细长的还是分成两行
else
:
# 不细长的还是分成两行
lines
=
2
lines
=
2
line_height
=
(
y1
-
y0
)
/
lines
line_height
=
(
y1
-
y0
)
/
lines
# 确定从哪个y位置开始绘制线条
# 确定从哪个y位置开始绘制线条
...
...
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