西游记词云

from wordcloud import WordCloud,ImageColorGenerator
import jieba
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image

with open('西游记.txt','r',encoding='gb18030') as f1:
d=f1.read()
wl=jieba.cut(d,cut_all=False)
data=','.join(wl)

font='C:\Windows\Fonts\STXINGKA.TTF'

wc1=WordCloud(font_path=font).generate(data)

plt.imshow(wc1,interpolation='bilinear')
plt.axis('off')
plt.show()

西游记词云

 

上一篇:POJ1515Street Direction(无向图改有向图)


下一篇:D. Cut