X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=segment.py;h=dd0b2a8347ee800c4addf996f369ea0293b47bb7;hb=3906e8a686e3d1943e22746b65c394a4def34fc0;hp=712895b6b0d7f1563ee4149fe7d94445a3931233;hpb=2985cc355e868951a2755be23d3503b05ba17ea7;p=cipher-tools.git diff --git a/segment.py b/segment.py index 712895b..dd0b2a8 100644 --- a/segment.py +++ b/segment.py @@ -1,4 +1,3 @@ -# import re, string, random, glob, operator, heapq import string import collections from math import log10 @@ -24,7 +23,7 @@ def splits(text, L=20): def Pwords(words): """The Naive Bayes log probability of a sequence of words. """ - return sum(Pw[w] for w in words) + return sum(Pw[w.lower()] for w in words) class Pdist(dict): """A probability distribution estimated from counts in datafile.