KevinHuSh
commited on
Commit
·
8f4f7c1
1
Parent(s):
f77c02e
fix divide by zero bug (#447)
Browse files### What problem does this PR solve?
#445
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
deepdoc/parser/pdf_parser.py
CHANGED
@@ -64,7 +64,7 @@ class HuParser:
|
|
64 |
"""
|
65 |
|
66 |
def __char_width(self, c):
|
67 |
-
return (c["x1"] - c["x0"]) // len(c["text"])
|
68 |
|
69 |
def __height(self, c):
|
70 |
return c["bottom"] - c["top"]
|
|
|
64 |
"""
|
65 |
|
66 |
def __char_width(self, c):
|
67 |
+
return (c["x1"] - c["x0"]) // max(len(c["text"]), 1)
|
68 |
|
69 |
def __height(self, c):
|
70 |
return c["bottom"] - c["top"]
|