您好,我第一次使用 nltk,我收到一个错误,我不知道如何排除故障,感谢您的帮助!
import nltk
nltk.download('wordnet')
lemmatizer = WordNetLemmatizer()
x = 'was'
y = 'is'
lemma = lemmatizer.lemmatize(x, 'v')
print(lemma) # Output: be```
The error that I am getting is that the wordnet resource is not found. I am running in Pycharm and using python as the language.
```LookupError:
**********************************************************************
Resource wordnet not found.
Please use the NLTK Downloader to obtain the resource:```
只需在下载后、运行词形还原之前导入 WordNetLemmatizer:
from nltk.stem import WordNetLemmatizer