Python的Nltk包
安装方法
http://www.nltk.org/install.html
使用
-
>>>
import nltk -
>>>
nltk.download()
nltk.download()
太慢了,所以我先手动下载好,解压,放到/usr/local/share/nltk_data
目录下
[root@10-10-198-186 nltk_data]# pwd
/usr/local/share/nltk_data
[root@10-10-198-186 nltk_data]# ls
chunkers corpora grammers
help stemmers
taggers tokenizers
即可
执行下面测试
-
>>>
from nltk.book import * -
***
Introductory Examples for the NLTK Book *** -
Loading
text1, ..., text9 and sent1, ..., sent9 -
Type
the name of the text or sentence to view it. -
Type:
'texts()' or 'sents()' to list the materials. -
text1:
Moby Dick by Herman Melville 1851 -
text2:
Sense and Sensibility by Jane Austen 1811 -
text3:
The Book of Genesis -
text4:
Inaugural Address Corpus -
text5:
Chat Corpus -
text6:
Monty Python and the Holy Grail -
text7:
Wall Street Journal -
text8:
Personals Corpus -
text9:
The Man Who Was Thursday by G . K . Chesterton 1908 -
>>>
说明成功