goe*_*goe 6 nlp corpus nltk python-3.x
我正在使用下面的代码并从 nltk 导入停用词
#from nltk.corpus import words as word_corp
from nltk.corpus import stopwords
nlp = spacy.load('en_core_web_sm')
phrase_matcher = PhraseMatcher(nlp.vocab)
en_words = nltk.corpus.words.words('en')
stop_words = stopwords.words('english')
Run Code Online (Sandbox Code Playgroud)
但错误就是AttributeError: 'getset_descriptor' object has no attribute 'setdefault' for ----> 3 nlp = spacy.load('en_core_web_sm')这一行。
我也遇到了这个问题 - 您使用的是哪个版本的 Python/spaCy?
我使用 Python 3.9.1 + spaCy 2.2.4 时发生了这种情况。
将 spaCy 升级到 3.0.0或将 Python 降级到 3.6.8后它对我有用(没有尝试其他版本)
| 归档时间: |
|
| 查看次数: |
1980 次 |
| 最近记录: |