import jieba
from wordcloud import WordCloud
from scipy.misc import imread
img = "C://Users//Administrator//Desktop//lc.jpg"
mask = imread(img)
locat = 'C:\\Users\\Administrator\\Desktop\\report.txt'
with open(locat,'r') as file:
text = file.read()
words = jieba.lcut(text)
words = " ".join(words)
wordcloud = WordCloud(background_color = "white",width = 800,height = 600,max_words=200,max_font_size=60,font_path="./fonts/simhei.ttf",mask =mask,).generate(words)
wordcloud.to_file("C:\\Users\\Administrator\\Desktop\\li.jpg")
```![在这里插入图片描述](https://img-blog.csdnimg.cn/20190306174049340.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjIzNzk4NA==,size_16,color_FFFFFF,t_70)
词云解读政府工作报告
最新推荐文章于 2022-03-27 04:00:00 发布