0


python词云图《三国演义》

import jieba
import wordcloud
file = open(“三国演义.txt”, “r”, encoding=“utf-8”)

t = file.read()
file.close()
ls = jieba.lcut(t)

txt = " ".join(ls)
w = wordcloud.WordCloud(
width=1000, height=700,
background_color=“white”,
font_path=“msyh.ttc”
)
w.generate(txt)
w.to_file(“2.png”)

标签:

本文转载自: https://blog.csdn.net/m0_61921127/article/details/121030750
版权归原作者 m0_61921127 所有, 如有侵权,请联系我们删除。

“python词云图《三国演义》”的评论:

还没有评论