Search code examples
pythonnltk

How to solve NLTK LookupError(resource_not_found) ? It exists in path. (Python)


I try to use nltk library, but i got stuck. I downloaded the stopwords library by hand (I cant download by code because of the permission issues on my working machine), but it always gives me the following error;

LookupError: 
**********************************************************************
  Resource stopwords not found.
  Please use the NLTK Downloader to obtain the resource:
....
Searched in:
  - '/home/skahraman/nltk_data'
....

My stopwords in nltk_data folder. So how can i solve this problem?

I tried following;

import string
import nltk
from nltk import word_tokenize
from nltk.corpus import stopwords
from collections import Counter
#nltk.download('stopwords')
nltk.data.path.append("/home/skahraman/nltk_data")
stop_words=stopwords.words("turkish")

Solution

  • My folder path was ; /home/skahraman/nltk_data/stopwords

    But it must be ; /home/skahraman/nltk_data/corpora/stopwords

    I added the corpora folder to my directory. So it works now.