词云


from wordcloud import WordCloud
from scipy.misc import imread
color_mask = imread("backgroun.jpg")
cloud = WordCloud()
    font_path="D:\\SourceHanSerif-Heavy.ttc"
    background_color='white'
    mask=color_mask
    max_words=100
word_cloud = cloud.generate_from_text(get_str_content)  
word_cloud.to_file("3.png")  
plt.imshow(word_cloud)
plt.axis('off')
plt.show()
from wordcloud import WordCloud
from scipy.misc import imread
color_mask = imread("backgroun.jpg")
cloud = WordCloud()
    font_path="D:\\SourceHanSerif-Heavy.ttc"
    background_color='white'
    mask=color_mask
    max_words=100
word_cloud = cloud.generate_from_text(get_str_content)  
word_cloud.to_file("3.png")  
plt.imshow(word_cloud)
plt.axis('off')
plt.show()

posted @ 2021-04-24 22:18  wznb  阅读(162)  评论(0)    收藏  举报