#词云的制作 在这里需要安装jieab和WordCloud两个库
import jieba
from wordcloud import WordCloud
import matplotlib.pyplot as plt
word_list = [" ".join(jieba.cut(sentence)) for sentence in list_w]
new_text = ' '.join(word_list)
wordcloud = WordCloud(font_path='simhei.ttf', background_color="black").generate(new_text)
plt.imshow(wordcloud)
plt.axis("off")
plt.show()
Python做词云图
最新推荐文章于 2024-05-29 09:24:10 发布