画像の背景:
ソースコード:
import jieba
import wordcloud
import imageio
m = imageio.imread( "Song of Ice and Fire.jpg")
f = open( "Song of Ice and
Fire.txt "、 "r")t = f.read()
txt = jieba .lcut(t)
f.close()wordlist
= ""
。join (txt)w = wordcloud.WordCloud(font_step = 2、background_color = "red"、\
font_path = "msyh.ttc"、mask = m、width = 800、\
高さ= 600、ストップワード= {"次のページ"、 "ディレクトリページ"、\
"前のページ"}、max_words = 200)
w.generate(
wordlist )w.to_file( "Song of Ice and Fire。 png ")
効果画像:
Ye XuとLai Yilinの協力のおかげで、クラスの他の生徒のブログ投稿を読んだ後、ほんの少ししかわかりませんでした。
遭遇する困難は主にインストールとデバッグにあり、最終的なデバッグは本当に人々のメンタリティを作ります。