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
8411c910
You need to sign in or sign up before continuing.
Commit
8411c910
authored
Jul 23, 2024
by
myhloli
Browse files
fix(magic_pdf): prevent division by zero in citationmarker removal
parent
e51d3e79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
magic_pdf/pre_proc/citationmarker_remove.py
magic_pdf/pre_proc/citationmarker_remove.py
+5
-1
No files found.
magic_pdf/pre_proc/citationmarker_remove.py
View file @
8411c910
...
@@ -135,7 +135,11 @@ def remove_citation_marker(with_char_text_blcoks):
...
@@ -135,7 +135,11 @@ def remove_citation_marker(with_char_text_blcoks):
if
max_font_sz
-
span_font_sz
<
1
:
# 先以字体过滤正文,如果是正文就不再继续判断了
if
max_font_sz
-
span_font_sz
<
1
:
# 先以字体过滤正文,如果是正文就不再继续判断了
continue
continue
# 对被除数为0的情况进行过滤
if
span_hi
==
0
or
min_font_sz
==
0
:
continue
if
(
base_span_mid_y
-
span_mid_y
)
/
span_hi
>
0.2
or
(
base_span_mid_y
-
span_mid_y
>
0
and
abs
(
span_font_sz
-
min_font_sz
)
/
min_font_sz
<
0.1
):
if
(
base_span_mid_y
-
span_mid_y
)
/
span_hi
>
0.2
or
(
base_span_mid_y
-
span_mid_y
>
0
and
abs
(
span_font_sz
-
min_font_sz
)
/
min_font_sz
<
0.1
):
"""
"""
1. 它的前一个char如果是句号或者逗号的话,那么肯定是角标而不是公式
1. 它的前一个char如果是句号或者逗号的话,那么肯定是角标而不是公式
...
...
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