词云

import jieba
import wordcloud
from imageio import imread

mask = imread("st.bmp")
excludes = { }
f = open("三体.txt", "r", encoding="utf-16")
t = f.read()
f.close()
ls = jieba.lcut(t)
txt = " ".join(ls)
w = wordcloud.WordCloud(width = 1000, height = 700,background_color = "white",font_path = "msyh.ttc", mask = mask,max_words=10000)
w.generate(txt)
w.to_file("cy1.bmp")
词云

上一篇:调整坐标值函数--供自己参考


下一篇:opencv_python 读取4通道png图片