Import WordNet into NLTK

I want to import a wordnet dictionary, but when I import a wordnet dictionary form, I see this error:

  for l in open(WNSEARCHDIR+'/lexnames').readlines(): IOError: [Errno 2] No such file or directory: 'C:\\Program Files\\WordNet\\2.0\\dict/lexnames' 

I install wordnet2.1 in this directory, but I can not import please help me solve this problem.

 import nltk from nltk import * from nltk.corpus import wordnet from wordnet import Dictionary print '-----------------------------------------' print Dictionary.length 
+4
source share
1 answer

The following works for me:

 >>> nltk.download() # Download window opens, fetch wordnet >>> from nltk.corpus import wordnet as wn 

Now I have a WordNetCorpusReader called wn . I don’t know why you are looking for the Dictionary class, since there is no such class in docs . The NLTK book in section 2.5 explains what you can do with the nltk.corpus.wordnet module.

+15
source

All Articles