Update 词云.py

main
pff5ls68k 2 months ago
parent 861ebc750c
commit dc0e9033bb

@ -9,6 +9,7 @@ txt = f.read()
print(txt) print(txt)
string = ''.join(jieba.lcut(txt)) string = ''.join(jieba.lcut(txt))
print(string) print(string)
# 设置词云图格式
wc = wordcloud.WordCloud( wc = wordcloud.WordCloud(
width=1000, width=1000,
height=1000, height=1000,
@ -17,5 +18,5 @@ wc = wordcloud.WordCloud(
font_path='msyh.ttc', font_path='msyh.ttc',
scale=15, scale=15,
) )
wc.generate(string) wc.generate(string) # 生成
wc.to_file('弹幕词云.png') wc.to_file('弹幕词云.png')

Loading…
Cancel
Save