sudo pip3 install nltk -i https://pypi.tuna.tsinghua.edu.cn/simple
安装完成后测试:
sudo python3
Python 3.7.3 (default, Mar 6 2020, 22:34:30)
[Clang 11.0.3 (clang-1103.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> porter = nltk.PorterStemmer()
>>> porter.stem('lying')
'lie'
继续运行 text = nltk.word_tokenize("And now for something completely different")
出现报错提示:
**********************************************************************
Resource punkt not found.
Please use the NLTK Downloader to obtain the resource:
>>> import nltk
>>> nltk.download('punkt')
则按照提示运行:
nltk.download('punkt')
相关文档
暂无
随便看看
畅言模块加载中