We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ec6012 commit 5574d77Copy full SHA for 5574d77
text.py
@@ -32,10 +32,10 @@ class NgramTextModel(CountingProbDist):
32
You can add, sample or get P[(word1, ..., wordn)]. The method P.samples(n)
33
builds up an n-word sequence; P.add and P.add_sequence add data."""
34
35
- def __init__(self, n, observation_sequence=[]):
+ def __init__(self, n, observation_sequence=[], default=0):
36
# In addition to the dictionary of n-tuples, cond_prob is a
37
# mapping from (w1, ..., wn-1) to P(wn | w1, ... wn-1)
38
- CountingProbDist.__init__(self)
+ CountingProbDist.__init__(self, default=default)
39
self.n = n
40
self.cond_prob = defaultdict()
41
self.add_sequence(observation_sequence)
0 commit comments