Example #1
0
 def __init__(self, n, observation_sequence=None, default=0):
     # In addition to the dictionary of n-tuples, cond_prob is a
     # mapping from (w1, ..., wn-1) to P(wn | w1, ... wn-1)
     CountingProbDist.__init__(self, default=default)
     self.n = n
     self.cond_prob = defaultdict()
     self.add_sequence(observation_sequence or [])
Example #2
0
 def __init__(self, observation_sequence=None, default=0):
     CountingProbDist.__init__(self, default=default)
     self.n = 1
     self.cond_prob = defaultdict()
     self.add_sequence(observation_sequence or [])