Problems installing NLTK data

I am trying to install NLTK data on Mac OSX 10.9. The download directory that will be installed as described in the NLTK 3.0 documentation is / usr / share / nltk _data for a central installation. But for this path I get an OSError error: [Errno 13] Permission denied: '/ usr / share / nltk_data'

Is it possible to set the download directory as / Users / ananya / nltk _data for a central installation?

I have Python 2.7 installed on my machine

Thanks Ananya

+6
source share
1 answer

You tried:

$ sudo python >>> import nltk >>> nltk.download() 

To check if the downloads work, try several cases you downloaded, for example

 >>> from nltk.corpus import wordnet >>> wordnet.synsets('dog') [Synset('dog.n.01'), Synset('frump.n.01'), Synset('dog.n.03'), Synset('cad.n.01'), Synset('frank.n.02'), Synset('pawl.n.01'), Synset('andiron.n.01'), Synset('chase.v.01')] 

If the cases are not installed correctly, you will see something like this:

 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/nltk/corpus/util.py", line 68, in __getattr__ self.__load() File "/usr/local/lib/python2.7/dist-packages/nltk/corpus/util.py", line 56, in __load except LookupError: raise e LookupError: ********************************************************************** Resource 'corpora/wordnet' not found. Please use the NLTK Downloader to obtain the resource: >>> nltk.download() Searched in: - '/home/alvas/nltk_data' - '/usr/share/nltk_data' - '/usr/local/share/nltk_data' - '/usr/lib/nltk_data' - '/usr/local/lib/nltk_data' ********************************************************************** 
+7
source

All Articles