wordc.py 文件源码

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

项目:jaychou 作者: fantasysea 项目源码 文件源码
def wordcloudplot(txt,name):
    path = 'msyh.ttf'
    path = unicode(path, 'utf8').encode('gb18030')
    alice_mask = np.array(PIL.Image.open('jay.jpg'))
    wordcloud = WordCloud(font_path=path,
                          background_color="white",
                          margin=5, width=1800, height=800, mask=alice_mask, max_words=2000, max_font_size=60,
                          random_state=42)
    wordcloud = wordcloud.generate(txt)
    wordcloud.to_file('../songs/'+name+'/'+name+'.jpg')
    plt.imshow(wordcloud)
    plt.axis("off")
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号