第一次使用nltk的時候,出現了這樣的錯誤:
from nltk.stem.wordnet import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
print(lemmatizer.lemmatize('computer'))
原來是需要先在本地下載wordnet
故,在console界面按照提示輸入:
>>> import nltk
>>> nltk.download('wordnet')
然后就可以了