Skip to content

Commit

Permalink
fix divide by zero bug (infiniflow#447)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

infiniflow#445 

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
KevinHuSh authored Apr 19, 2024
1 parent 39f1fea commit 962c667
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion deepdoc/parser/pdf_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self):
"""

def __char_width(self, c):
return (c["x1"] - c["x0"]) // len(c["text"])
return (c["x1"] - c["x0"]) // max(len(c["text"]), 1)

def __height(self, c):
return c["bottom"] - c["top"]
Expand Down

0 comments on commit 962c667

Please sign in to comment.