Python的Nltk包安装使用

来源:互联网 发布:照片生成器软件 编辑:程序博客网 时间:2024/06/16 05:04
Python的Nltk包
安装方法
http://www.nltk.org/install.html


使用
  1. >>> import nltk  
  2. >>> 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

即可
执行下面测试
  1. >>> from nltk.book import  
  2. *** Introductory Examples for the NLTK Book ***  
  3. Loading text1, ..., text9 and sent1, ..., sent9  
  4. Type the name of the text or sentence to view it.  
  5. Type: 'texts()' or 'sents()' to list the materials.  
  6. text1: Moby Dick by Herman Melville 1851  
  7. text2: Sense and Sensibility by Jane Austen 1811  
  8. text3: The Book of Genesis  
  9. text4: Inaugural Address Corpus  
  10. text5: Chat Corpus  
  11. text6: Monty Python and the Holy Grail  
  12. text7: Wall Street Journal  
  13. text8: Personals Corpus  
  14. text9: The Man Who Was Thursday by Chesterton 1908  
  15. >>>  

说明成功
0 0
原创粉丝点击