def lyrics():
with open('lyrics.json', 'r', encoding='utf-8') as f:
data = json.load(f)
tokens = list()
for v in data.values():
# ??????, ???????? 2 ??, ?????
tokens += [seg for seg in jieba.cut(v) if seg.split() and len(seg) > 1]
# ?? tokens ?????????
counter = Counter(tokens)
print(counter.most_common(10))
# ???, ???????????
wcloud = WordCloud(font_path='NotoSansMonoCJKtc-Regular.otf').generate(' '.join(tokens))
plt.imshow(wcloud)
plt.axis('off')
plt.show()
评论列表
文章目录