Python网络数据采集10(译者:哈雷)
来源:互联网 发布:java urlclassloader 编辑:程序博客网 时间:2024/04/27 18:00
第八章 自然语言的读写
本章的前半部分我感觉跟普通的数据处理过程差不多,然后讲了马尔科夫链的状态转换,最后讲述了nltk(自然语言处理包)的使用,对于做自然语言处理的同学们来说,nltk的重要性就无需赘言了,本文也不打算详细的叙述其使用,建议同学们系统的学习一下。下面着重讲解nltk,python2.7下安装如下
python -m nltk.downloader all
在python3.0下安装如下
pip3 install nltk #当然python2.7下也可以用pip2 install nltk 来安装nltk
在使用nltk包的过程中,由于nltk包很大,所以不建议全部导入,当然如果工程大,涉猎广,就必须全部导入了。安装完成以后,就可以进行语言分析啦。例如
from nltk import ngrams from nltk import FreqDist from nltk.book import * fourgrams = ngrams(text6, 4)#每四个作为i一个元素 fourgramsDist = FreqDist(fourgrams) a=fourgramsDist[("father", "smelt", "of", "elderberries")]#这四个单词同时出现的次数 print (fourgramsDist.most_common(10))#最常见的10个元素 print(a)
书中还讲述了利用nltk中的词性分析来处理自然语言(英文),读者可以自行查阅,不过我个人认为一般情况下用不到。
0 0
- Python网络数据采集10(译者:哈雷)
- Python网络数据采集1(译者:哈雷)
- Python网络数据采集4(译者:哈雷)
- Python网络数据采集5(译者:哈雷)
- Python网络数据采集6(译者:哈雷)
- Python网络数据采集7(译者:哈雷)
- Python网络数据采集8(译者:哈雷)
- Python网络数据采集9(译者:哈雷)
- Python网络数据采集11(译者:哈雷)
- python网络数据采集2(译者:哈雷)
- python网络数据采集3(译者:哈雷)
- python网络数据采集
- Python网络数据采集
- Python网络数据采集
- Python网络数据采集
- Python网络数据采集
- Python网络数据采集
- Python网络数据采集
- a说他不和x比,c说他不和x,z比,请编程序找出三队赛手的名单
- android Gradle介绍
- javascript同源策略和跨域实验及其跨域解决办法
- 学习CUDA_01关于NVIDIA
- win10系统下SQL2012下载及安装
- Python网络数据采集10(译者:哈雷)
- 浅谈tomcat
- 左旋转字符串
- 冒泡排序速记
- 解决Android4.4及以上系统获取系统图片失败的问题,例如华为手机,调系统图库的时候就出现异常
- 自定义吐司Toast
- openssl公钥加密私钥解密 &私钥加密公钥解密
- 数据分析常用数据源汇总
- bootstrap教程(二) —— 列表组listgroup