Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
isnowfy committed Aug 31, 2014
1 parent 73c1494 commit 373aadd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def read(fname):

setup(
name='snownlp',
version='0.12.0',
version='0.12.1',
description='Python library for processing Chinese text',
author='isnowfy',
url='https://github.com/isnowfy/snownlp',
Expand Down
9 changes: 6 additions & 3 deletions snownlp/classification/bayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ def classify(self, x):
ret, prob = 0, 0
for k in self.d:
now = 0
for otherk in self.d:
now += exp(tmp[otherk]-tmp[k])
now = 1/now
try:
for otherk in self.d:
now += exp(tmp[otherk]-tmp[k])
now = 1/now
except OverflowError:
now = 0
if now > prob:
ret, prob = k, now
return (ret, prob)

0 comments on commit 373aadd

Please sign in to comment.