From 888dc124f4028affa778828e2acc4579f6fe1a15 Mon Sep 17 00:00:00 2001 From: Anthony Marakis Date: Wed, 14 Feb 2018 22:50:40 +0200 Subject: [PATCH] Update text.py --- text.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/text.py b/text.py index c62c1627a..8dc0ab855 100644 --- a/text.py +++ b/text.py @@ -21,6 +21,11 @@ class UnigramWordModel(CountingProbDist): can add, sample, or get P[word], just like with CountingProbDist. You can also generate a random text, n words long, with P.samples(n).""" + def __init__(self, observations, default=0): + # Call CountingProbDist constructor, + # passing the observations and default parameters. + super(UnigramWordModel, self).__init__(observations, default) + def samples(self, n): """Return a string of n words, random according to the model.""" return ' '.join(self.sample() for i in range(n)) @@ -203,7 +208,7 @@ class UnixConsultant(IRSystem): def __init__(self): IRSystem.__init__(self, stopwords="how do i the a of") - + import os aima_root = os.path.dirname(__file__) mandir = os.path.join(aima_root, 'aima-data/MAN/')