grantjenks / python-wordsegment

English word segmentation, written in pure-Python, and based on a trillion-word corpus.
http://www.grantjenks.com/docs/wordsegment/
Other
365 stars 49 forks source link

ZeroDivisionError #13

Closed wcollins-ebsco closed 6 years ago

wcollins-ebsco commented 7 years ago

using wordsegment-1.1.6-py2.py3-none-any.whl

import wordsegment as ws seg=ws.Segmenter() seg.score('industry','oil') Traceback (most recent call last): File "<pyshell#21>", line 1, in seg.score('industry','oil') File "C:\Python3\lib\site-packages\wordsegment__init.py", line 108, in score return self.score(word) File "C:\Python3\lib\site-packages\wordsegment\init__.py", line 93, in score return 10.0 / (total * 10 ** len(word)) ZeroDivisionError: float division by zero

grantjenks commented 7 years ago

Call seg.load() before seg.score()

wcollins-ebsco commented 7 years ago

Thank you, that worked.