2018年11月16日

摘要: import jiebaimport numpy as np# 打开词典文件,返回列表def open_dict(Dict='hahah',path = 'C:\E\Textming\Textming/'): path = path + '%s.txt' %Dict dictionary = ope 阅读全文
posted @ 2018-11-16 17:35 happygril3 阅读(2277) 评论(1) 推荐(0)
摘要: def cmp(e1,e2): #输出关键词,按照关键词的计算分值排序,在得分相同,根据关键词排序 import numpy as np res=np.sign(e1[1]-e2[1]) if res!=0: return res else: a=e1[0]+e2[0] b=e2[0]+e1[0] 阅读全文
posted @ 2018-11-16 17:14 happygril3 阅读(383) 评论(0) 推荐(0)
摘要: # https://blog.csdn.net/whzhcahzxh/article/details/17528261# gensim包中引用corpora,models, similarities,分别做语料库建立,模型库和相似度比较库from gensim import corpora, mod 阅读全文
posted @ 2018-11-16 16:38 happygril3 阅读(935) 评论(0) 推荐(0)
摘要: from snownlp import SnowNLP text='宝贝自拍很帅!!!注意休息~'s=SnowNLP(text)#分词print(s.words)#词性for tag in s.tags: print(tag)#情感度,积极的概率print(s.sentiments)#关键词prin 阅读全文
posted @ 2018-11-16 15:48 happygril3 阅读(198) 评论(0) 推荐(0)
摘要: from scipy.misc import imread # 这是一个处理图像的函数from wordcloud import WordCloud,STOPWORDS,ImageColorGeneratorimport matplotlib.pyplot as pltimport pandas a 阅读全文
posted @ 2018-11-16 14:59 happygril3 阅读(174) 评论(0) 推荐(0)

导航