词云摘抄

from wordcloud import WordCloud
import matplotlib.pyplot as plt 
import jieba     
path_txt='盗墓笔记.txt'
f = open(path_txt,'r',encoding='UTF-8').read()
cut_text = " ".join(jieba.cut(f))
wordcloud = WordCloud(
  font_path="C:/Windows/Fonts/simfang.ttf",
  background_color="white",width=1920,height=1080).generate(cut_text)
plt.imshow(wordcloud, interpolation="bilinear")
plt.axis("off")
plt.show()

词云摘抄

上一篇:Python-好玩的词云【Wordcloud库的使用】


下一篇:python词云图之WordCloud