Tweaked some slides.
authorNeil Smith <neil.git@njae.me.uk>
Thu, 17 Jul 2014 22:20:50 +0000 (23:20 +0100)
committerNeil Smith <neil.git@njae.me.uk>
Thu, 17 Jul 2014 22:20:50 +0000 (23:20 +0100)
language_models.py
slides/word-segmentation.html

index 59d858868dd5b67d5de9dd848fe26d6b5f1c6391..63aac6bab48daf56f1bcec1fd649121d1d86f17b 100644 (file)
@@ -100,7 +100,7 @@ def ngrams(text, n):
     """
     return [text[i:i+n] for i in range(len(text)-n+1)]
 
-
+    
 class Pdist(dict):
     """A probability distribution estimated from counts in datafile.
     Values are stored and returned as log probabilities.
index 6215255ca3c4825937d0d1177e4a54b64bce6b23..9c3b3092babc6ba5770692c391c193d2d9e39446 100644 (file)
@@ -149,9 +149,9 @@ def Pwords(words):
 ```python
 >>> 'hello' in Pw.keys()       >>> Pwords(['hello'])
 True                           -4.25147684171819
->>> 'inigo' in Pw.keys()       >>> Pwords(['hello', 'my'])
+>>> 'inigo' in Pw              >>> Pwords(['hello', 'my'])
 True                           -6.995724679281423
->>> 'blj' in Pw.keys()         >>> Pwords(['hello', 'my', 'name'])
+>>> 'blj' in Pw                >>> Pwords(['hello', 'my', 'name'])
 False                          -10.098177451501074
 >>> Pw['hello']                >>> Pwords(['hello', 'my', 'name', 'is'])
 -4.25147684171819              -12.195018236240843