Esempio n. 1
0
 def __init__(self, n, strings):
     if n is None:
         assert(strings is None)
         return
     ngpol = NGramPOL(n)
     for s in strings:
         ngpol.add(s)
     sample = [ngpol.rate(s) for s in strings]
     dist = SampleDistribution(sample)
     self.ngpol = ngpol
     self.dist = dist
Esempio n. 2
0
 def fromfile(f):
     s = NgramProbSet(None,None)
     s.dist = pickle.load(f)
     s.ngpol = NGramPOL.fromfile(f)
     return s