Skip to content

Commit 8dbf924

Browse files
antmarakisnorvig
authored andcommitted
Update text.py (aimacode#740)
1 parent 195708d commit 8dbf924

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

text.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ class UnigramWordModel(CountingProbDist):
2121
can add, sample, or get P[word], just like with CountingProbDist. You can
2222
also generate a random text, n words long, with P.samples(n)."""
2323

24+
def __init__(self, observations, default=0):
25+
# Call CountingProbDist constructor,
26+
# passing the observations and default parameters.
27+
super(UnigramWordModel, self).__init__(observations, default)
28+
2429
def samples(self, n):
2530
"""Return a string of n words, random according to the model."""
2631
return ' '.join(self.sample() for i in range(n))
@@ -203,7 +208,7 @@ class UnixConsultant(IRSystem):
203208

204209
def __init__(self):
205210
IRSystem.__init__(self, stopwords="how do i the a of")
206-
211+
207212
import os
208213
aima_root = os.path.dirname(__file__)
209214
mandir = os.path.join(aima_root, 'aima-data/MAN/')

0 commit comments

Comments
 (0)