这是我使用一份简历描述做的词云。
使用了自定义词典。
使用了停词词典。
效果还不错吧!
import jieba
import jieba.analyse
import wordcloud
from scipy.misc import imread
mask = imread("chinamap.jpg")
excludes = { }
f = open("1.txt", "r", encoding="utf-8")
t = f.read()
f.close()
jieba.load_userdict("dic.txt")
jieba.analyse.set_stop_words("stop.txt")
ls = jieba.analyse.extract_tags(t,topK=100)
txt = " ".join(ls)
w = wordcloud.WordCloud(\
width = 1000, height = 700,\
background_color = "white",mask =mask,font_path='/Library/Fonts/Songti.ttc',\
)
w.generate(txt)
w.to_file("grwordcloudm.png")