2020
12-22
12-22
python中实现词云图的示例
importmatplotlib.pyplotaspltimportjiebafromwordcloudimportwordcloud#1.读出词语text=open('text/test.txt','r',encoding='utf-8').read()print(text)#2.把歌词剪开cut_text=jieba.cut(text)#print(type(cut_text))#print(next(cut_text))#print(next(cut_text))#3.以空格拼接起来result="".join(cut_text)#print(result)#4.生成词云wc=wordcloud.WordCloud(font_path='font/王?h宗勘亭流繁.ttf',...
继续阅读 >