Forums

NLTK LookupError

Hi, I'm trying to use NLTK for a chatbot, locally it runs fine. On PA however I get a lookup error on wordnet (#033[93mcorpora/wordnet#033[0m). If I run ntlk.download the configuration seems correct:

>>> nltk.download()
> Local Machine:
>   - Data directory: /home/vvephl2/nltk_data

If I run a test I see it cannot find the file but says it searches the correct dir...

 >>> import nltk
 >>> nltk.download('brown')

  For more information see: https://www.nltk.org/data.html
  Attempted to load corpora/brown
  Searched in:
    - '/home/vvephl2/nltk_data'

On PA the directory /home/vvephl2/nltk_data/corpora contains the file wordnet.zip

What can I do to make it work? :)

Regards, Jos

(fan of PA!!)

I guess, you need to unzip it -- see: https://www.nltk.org/data.html#manual-installation

wordnet.zip file or unzipped (in dir corpora) makes no difference.

Below the error given:


raise LookupError(resource_not_found)

LookupError:


Resource #033[93mwordnet#033[0m not found. Please use the NLTK Downloader to obtain the resource: NO MATCH #033[31m>>> import nltk

nltk.download('wordnet') #033[0m For more information see: https://www.nltk.org/data.html NO MATCH Attempted to load #033[93mcorpora/wordnet#033[0m NO MATCH Searched in: - '/home/vvephl2/nltk_data' - '/usr/local/nltk_data' - '/usr/local/share/nltk_data' - '/usr/local/lib/nltk_data' - '/usr/share/nltk_data' - '/usr/local/share/nltk_data' - '/usr/lib/nltk_data' - '/usr/local/lib/nltk_data'


Locally the zip file isn't unzipped as well!

in addition... When I try to download wordnet it says its already up to date...

21:53 ~ $ python3 -c "import nltk; nltk.download('wordnet')"                                                                                
[nltk_data] Downloading package wordnet to /home/vvephl2/nltk_data...
[nltk_data]   Package wordnet is already up-to-date!

Maybe ask in https://github.com/nltk/nltk/issues as it looks like it's related to how it works internally.