log(1)==0, since we have changed from PRODUCT to sum of LOG

This commit is contained in:
fxsjy 2013-04-25 10:11:04 +08:00
parent c350fab2b9
commit 47d94a13e6

View File

@ -87,7 +87,7 @@ def __cut_all(sentence):
def calc(sentence,DAG,idx,route):
N = len(sentence)
route[N] = (1.0,'')
route[N] = (0.0,'')
for idx in xrange(N-1,-1,-1):
candidates = [ ( FREQ.get(sentence[idx:x+1],min_freq) + route[x+1][0],x ) for x in DAG[idx] ]
route[idx] = max(candidates)