parent
1c7f81479e
commit
fc56f89ac2
@ -0,0 +1,11 @@
|
|||||||
|
def create_word_cloud(keyword_counts):
|
||||||
|
"""
|
||||||
|
生成词云图。
|
||||||
|
:param keyword_counts: 关键词及其出现次数的字典
|
||||||
|
"""
|
||||||
|
wc = WordCloud(font_path='simhei.ttf', background_color='white', width=800, height=600)
|
||||||
|
wc.generate_from_frequencies(keyword_counts)
|
||||||
|
plt.imshow(wc, interpolation='bilinear')
|
||||||
|
plt.axis("off")
|
||||||
|
plt.title("Top Danmakus Related to AI Technology in 2024 Paris Olympics")
|
||||||
|
plt.show()
|
Loading…
Reference in new issue