![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
qr457535344
这个作者很懒,什么都没留下…
展开
-
anaconda安装gensim错误Cannot uninstall 'scipy',It is a distutils installed project and thus we cannot...
Cannot uninstall 'scipy'It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.这个时候打开Anaconda Navigator, 在env...原创 2018-05-03 19:36:50 · 2971 阅读 · 0 评论 -
《Python自然语言处理》笔记-文本上下文操作了解一下
from nltk.book import *text1text2.concordance("monstrous")#查找text2中所有出现的关于词monstrous的上下文text3.similar("summer")#查找text3中所有和词summer具有相似上下文的词text4.common_contexts(["work","time"])#返回共用多个词如work和t...原创 2018-08-09 20:02:37 · 504 阅读 · 0 评论 -
《Python自然语言处理》笔记-将文本当做词链表
1. 文本统计len(text1)#text1从头到尾的长度,包含单词和标点符号set(text2)#获得text2的词汇表sorted(set(text3))#获得text3词汇表的排序表len(set(text4))#获得text4词汇表的长度len(text5)/len(set(text5))#获得text5的词汇丰富度,即,每个词平均使用的次数text6.count...原创 2018-08-11 16:39:32 · 288 阅读 · 0 评论 -
《Python自然语言处理》笔记-简单的统计
freq=FreqDist(text2)#统计text2中出现的所有词,以及每个词出现的次数vacabulary=freq.keys()#1中的结果为键值对,此操作可以用来取词汇表freq["ought"]#由1中的结果取某一个词的词频freq.plot(50,cumulative=True)#根据1中的结果绘制前50个词的累计频率图freq.hapaxes()#取1中只出现了一次...原创 2018-08-13 22:30:56 · 277 阅读 · 0 评论