本文整理汇总了Python中Graphics.frequency_plot方法的典型用法代码示例。如果您正苦于以下问题:Python Graphics.frequency_plot方法的具体用法?Python Graphics.frequency_plot怎么用?Python Graphics.frequency_plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics.frequency_plot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list
# 需要导入模块: import Graphics [as 别名]
# 或者: from Graphics import frequency_plot [as 别名]
import string, csv, itertools, nltk
import Graphics as artist
import utils as tech
from nltk.util import ngrams
from awesome_print import ap
data = list(csv.DictReader(open('comments.csv','rb')))
text = tech.cleanse(' '.join(itertools.chain(record['Student Comment'] for record in data)))
tech.savelines(text,filename='all-words-cleansed')
fdist = nltk.FreqDist(text)
tech.savelines(zip(*fdist.most_common(100)),filename='overall-frequencies-cleansed')
bigram_fdist = nltk.FreqDist(ngrams(text,2))
tech.savelines(zip(*bigram_fdist.most_common(100)),filename='bigram-frequencies-cleansed')
artist.frequency_plot(fdist,filename='overall-frequency-distribution')