mywordCloud.py 文件源码

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

项目:warWolf 作者: wu-yy 项目源码 文件源码
def draw_wordcloud(file_name):
    with codecs.open(file_name,encoding='utf-8') as f:
        comment_text=f.read()
    color_mask=imread('template.png') #??????
    stopwords = [u'??', u'??', u'??', u'??', u'??', u'??', u'??', u'??', u'??', u'??', u'??', u'??', u'??', u'??',
                 u'??', u'??', u'??', u'??']
    font = r'C:\Windows\Fonts\simfang.ttf'
    cloud=WordCloud(font_path=font,background_color='white',max_words=20000,max_font_size=200,min_font_size=4,mask=color_mask,stopwords=stopwords)
    word_cloud=cloud.generate(comment_text)  #????
    word_cloud.to_file('pjl_cloud.jpg')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号