WC.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:FacebookGraphAPI-Examples 作者: nikhilkumarsingh 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号