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)

Files changed (1) hide show
  1. deepdoc/parser/pdf_parser.py +1 -1
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"]