添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On a Mac using Python 3.6 and Anaconda. Have installed NLTK and used both command line and manual download of stop words. I see the stop word folder in NLTK folder, but cannot get it to load in my Jupyter notebook:

from nltk.corpus import stopwords

LookupError Traceback (most recent call last)
/anaconda3/lib/python3.6/site-packages/nltk/corpus/util.py in __load(self)
79 except LookupError as e:
---> 80 try: root = nltk.data.find('{}/{}'.format(self.subdir, zip_name))
81 except LookupError: raise e

/anaconda3/lib/python3.6/site-packages/nltk/data.py in find(resource_name, paths)
672 resource_not_found = '\n%s\n%s\n%s\n' % (sep, msg, sep)
--> 673 raise LookupError(resource_not_found)

LookupError:

Resource stopwords not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('stopwords')

Searched in:
- '/Users/ksednew/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
- '/anaconda3/nltk_data'
- '/anaconda3/lib/nltk_data'

During handling of the above exception, another exception occurred:

LookupError Traceback (most recent call last)
in ()
1 from nltk.corpus import stopwords
----> 2 stop = stopwords.words("english")
3 def stopwords(x):
4 x = re.sub("[^a-z\s]", " ", x.lower())
5 x = [w for w in x.split()

/anaconda3/lib/python3.6/site-packages/nltk/corpus/util.py in getattr (self, attr)
114 raise AttributeError("LazyCorpusLoader object has no attribute ' bases '")
--> 116 self.__load()
117 # This looks circular, but its not, since __load() changes our
118 # class to something new:

/anaconda3/lib/python3.6/site-packages/nltk/corpus/util.py in __load(self)
79 except LookupError as e:
80 try: root = nltk.data.find('{}/{}'.format(self.subdir, zip_name))
---> 81 except LookupError: raise e
83 # Load the corpus.

/anaconda3/lib/python3.6/site-packages/nltk/corpus/util.py in __load(self)
76 else:
77 try:
---> 78 root = nltk.data.find('{}/{}'.format(self.subdir, self.__name))
79 except LookupError as e:
80 try: root = nltk.data.find('{}/{}'.format(self.subdir, zip_name))

/anaconda3/lib/python3.6/site-packages/nltk/data.py in find(resource_name, paths)
671 sep = '*' * 70
672 resource_not_found = '\n%s\n%s\n%s\n' % (sep, msg, sep)
--> 673 raise LookupError(resource_not_found)

LookupError:

Resource stopwords not found.
Please use the NLTK Downloader to obtain the resource:

import nltk
nltk.download('stopwords')

Searched in:
- '/Users/ksednew/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
- '/anaconda3/nltk_data'
- '/anaconda3/lib/nltk_data'

I have tried placing copies the stopwords folder in various places (where it says it searched) as well as in the corpus folder and still no luck. Any ideas?

Interesting, I thought on my other Mac running the same versions, it had worked, but I may be wrong.

I will add that I was not able to download the Stopwords corpora because of issues involving my company's proxy:

nltk.download('stopwords')
[nltk_data] Error loading stopwords: <urlopen error [SSL:
[nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed
[nltk_data] (_ssl.c:833)>

If you have ideas for that, maybe that would solve it. I'm wondering if I'm just dropping the manually downloaded version in the wrong place.

Are there any updates to this? It seems no one every commented as to whether this is a problem with the third-party's support of Python 3.6 or something else.

Further, it sounds like this is a problem on your local machine @ksednew and I'm not certain how this is relevant to the buildpack.