hello ,
when i run this code for unigramtagger :
from nltk.tagger import *
from nltk.corpus import brown
# Tokenize ten texts from the Brown Corpus
train_tokens = []
for item in brown.items()[:10]:
train_tokens.append(brown.read(item))
# Initialise and train a unigram tagger
mytagger = UnigramTagger(SUBTOKENS='WORDS')
for tok in train_tokens: mytagger.train(tok)
#Once a UnigramTagger has been trained, the tag() method can be used to tag new text:
text_token = Token(TEXT="John saw the book on the table")
WhitespaceTokenizer(SUBTOKENS='WORDS').tokenize(text_token)
mytagger.tag(text_token)
print text_token
i got the following :
Traceback (most recent call last):
File "F:\MSC first Chapters\unigramgtag1.py", line 5, in -toplevel-
for item in brown.items()[:10]:
File "C:\Python24\Lib\site-packages\nltk\corpus\__init__.py", line 589, in items
self._initialize()
File "C:\Python24\Lib\site-packages\nltk\corpus\__init__.py", line 518, in _initialize
raise IOError('%s is not installed' % self._name)
IOError: brown is not installed
although i have extracted the brown folder and put it in the NLTK path
what should i do
thanks in advance
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
-- http://mail.python.org/mailman/listinfo/python-list