用户:高艳春(明亮白钢)查看:1 回复:1 评论:1 创建时间:2023-02-07T16:50:51
【作品展示】

【作品介绍】
sb
【作品源代码】
import jieba
import imageio
from wordcloud import WordCloud
with open('哪吒短评.txt', encoding='utf-8') as f:
text = f.read()
seg_list = jieba.lcut(text)
text = ' '.join(seg_list)
with open('stopwords.txt', encoding='utf-8') as f:
stopwords = f.read().split('\n')
stopwords+=['这部','一部']
mask = imageio.imread('nezha_mask.png')
wordcloud = WordCloud(
font_path='思源黑体.otf',
background_color='white',
max_words=2000,
width=1000,
height=1000,
mask=mask
).generate(text)
wordcloud.to_file('4.png')
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn