2

I am using pycharm IDE. I dowloaded nltk using file-> settings-> Project Interpreter -> nltk. After running my code below I have received an Lookup error

My code

# My Code
def get_tags(s):
    tuples = pos_tag(word_tokenize(s))
    return [y for x, y in tuples]
    
s = 'She does look like you. Stay the way you are.'
get_tags(s)

Look up error

> LookupError: 
> **********************************************************************   Resource punkt not found.   Please use the NLTK Downloader to obtain
> the resource:    import nltk
>   >>> nltk.download('punkt')
>      For more information see: https://www.nltk.org/data.html   Attempted to load tokenizers/punkt/english.pickle   Searched in:
>     - 'C:\\Users\\VW3ZTWS/nltk_data'
>     - 'C:\\Users\\VW3ZTWS\\PycharmProjects\\Data_Collection_and_learnings\\venv\\nltk_data'
>     - 'C:\\Users\\VW3ZTWS\\PycharmProjects\\Data_Collection_and_learnings\\venv\\share\\nltk_data'
>     - 'C:\\Users\\VW3ZTWS\\PycharmProjects\\Data_Collection_and_learnings\\venv\\lib\\nltk_data'
>     - 'C:\\Users\\VW3ZTWS\\AppData\\Roaming\\nltk_data'
>     - 'C:\\nltk_data'
>     - 'D:\\nltk_data'
>     - 'E:\\nltk_data'
>     - ''
> **********************************************************************

What i tried

I googled and follow the info from link1 and Link2. But none solved my problem. Even i tried manually by downloading the Punkt tokenizer model from Link3 and save it in tokenizers folder with unzipped files and tried to run my code. But still it does not work.

Kindly support to solve this issue

enter image description here

enter image description here

comments reference picture

enter image description here

enter image description here

enter image description here

enter image description here

Mari
  • 698
  • 1
  • 8
  • 27
  • Just do this in the code `import nltk; nltk.download('punkt')` without the GUI. – alvas May 16 '19 at 08:43
  • When i do that this is what I get... ``import nltk nltk.download('punkt') [nltk_data] Error loading punkt: Out[34]: False `` – Mari May 16 '19 at 08:44
  • Also, I have tried downloader directly, but some error splits out, please see the picture in the question now , i had edited.... – Mari May 16 '19 at 08:47
  • Does your machine have access to internet? – alvas May 16 '19 at 09:22
  • Are you using windows? – alvas May 16 '19 at 09:25
  • Could you try this on your command line before the Python interpreter? `pip install -U pip` and then `pip install -U nltk`. Then inside Python `import nltk; nltk.download('punkt')` – alvas May 16 '19 at 09:27
  • I am using windows – Mari May 16 '19 at 09:43
  • What is the output when you run the instructions in my last comment? – alvas May 16 '19 at 09:45
  • please refer to the picture added in the question.I tried the following in cmd 1)pip install nltk 2)pip install -U pip 3) pip install -U nltk – Mari May 16 '19 at 09:56
  • After that, could you do `python -m nltk.downloader popular`? Then try to use punkt again, it should work. – alvas May 17 '19 at 01:07
  • Still i cannot able to download it, even after using the command. please refer to the picture in my question @alvas – Mari May 17 '19 at 07:16

0 Answers0