NLTK:自然语言处理工具包,是聊天机器人需要的比较重要的一个工具
安装:pip install nltk
[root@centos #] python
Python 2.7.11 (default, Jan 22 2016, 08:29:18)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> nltk.download()
功能:
搜索文本
text1.concordance(“former”)
词统计
len(text):返回总字数
set(text):返回文本总词数
自然语言处理关键点
两个派别:
规则派
统计派