From 243c25814ad96c4671bf11ad2f85795cb46ca1ec Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 7 May 2018 20:56:29 -0400 Subject: [PATCH] fixed code --- book/ch05.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/ch05.rst b/book/ch05.rst index 5ccd07a9..e5230e4b 100644 --- a/book/ch05.rst +++ b/book/ch05.rst @@ -62,7 +62,7 @@ Using a Tagger A part-of-speech tagger, or `POS-tagger`:dt:, processes a sequence of words, and attaches a part of speech tag to each word (don't forget to ``import nltk``): - >>> text = word_tokenize("And now for something completely different") + >>> text = nltk.word_tokenize("And now for something completely different") >>> nltk.pos_tag(text) [('And', 'CC'), ('now', 'RB'), ('for', 'IN'), ('something', 'NN'), ('completely', 'RB'), ('different', 'JJ')] @@ -83,7 +83,7 @@ Here we see that `and`:lx: is ``CC``, a coordinating conjunction; Let's look at another example, this time including some homonyms: - >>> text = word_tokenize("They refuse to permit us to obtain the refuse permit") + >>> text = nltk.word_tokenize("They refuse to permit us to obtain the refuse permit") >>> nltk.pos_tag(text) [('They', 'PRP'), ('refuse', 'VBP'), ('to', 'TO'), ('permit', 'VB'), ('us', 'PRP'), ('to', 'TO'), ('obtain', 'VB'), ('the', 'DT'), ('refuse', 'NN'), ('permit', 'NN')]