def wcloud(text):
mask = np.array(Image.open("face_mask.png")) #choose mask
stopwords = set(STOPWORDS)
wc = WordCloud(background_color="white",
mask=mask,
max_words=80,
stopwords=stopwords,
width=800,
height=400,
mode="RGB",
relative_scaling=0.5,
)
text = clean_text(text)
wc.generate(text)
#save image
file_name = raw_input("Enter any name for the Word Cloud image:") +'.png'
wc.to_file(file_name)
return
评论列表
文章目录