我们首先来加载我们自己的文本文件,并统计出排名前20的字符频率 if __name__=="__main__": corpus_root='/home/zhf/word' wordlists=PlaintextCorpusReader(corpus_root,'.*') for w in wordlists.words(): print(w) fdist=FreqDist(wordlists.words()) fdist.plot(20,cumulative=True) 文本内容如下:…
参考链接:https://www.jianshu.com/p/240ea3ae0dc9 在使用matplotlib画饼状图时,遇到了如下问题 UserWarning: findfont: Font family [u'sans-serif'] not found. Falling back to DejaVu Sans (prop.get_family(), self.defaultFamily[fontext])) 解决方案如下: 1. 找到matplotlibrc这个文件 --> 搜索axe…