def main(): fin = open("/Users/moguranosenshi/WorkSpace/100knock2015/kajiwara/data/neko.txt.mecab", "r") morph_lists = mogura.get_morphs(fin) fin.close() word2freq = mogu_count.word_count(morph_lists) x, y = count_number_of_difference(word2freq) plot.bar(x[:30], y[:30]) plot.show()
def main(): fin = open("/Users/moguranosenshi/WorkSpace/100knock2015/kajiwara/data/neko.txt.mecab", "r") morph_lists = mogura.get_morphs(fin) fin.close() word2freq = mogu_count.word_count(morph_lists) plot.plot(range(len(word2freq.keys())), [freq for word, freq in sorted(word2freq.items(), key=lambda x: x[1], reverse=True)]) plot.xscale("log") plot.yscale("log") plot.show()
def main(): num = 10 fin = open("/Users/moguranosenshi/WorkSpace/100knock2015/kajiwara/data/neko.txt.mecab", "r") morph_lists = mogura.get_morphs(fin) fin.close() word2freq = mogu_count.word_count(morph_lists) plot.bar(range(1, num+1), [freq for word, freq in sorted(word2freq.items(), key=lambda x: x[1], reverse=True)][:num], align="center") plot.xticks(range(1, num+1), [word.decode("utf-8") for word, freq in sorted(word2freq.items(), key=lambda x: x[1], reverse=True)][:num]) plot.show()
def main(): fin = open( "/Users/moguranosenshi/WorkSpace/100knock2015/kajiwara/data/neko.txt.mecab", "r") morph_lists = mogura.get_morphs(fin) fin.close() word2freq = mogu_count.word_count(morph_lists) x, y = count_number_of_difference(word2freq) plot.bar(x[:30], y[:30]) plot.show()
def main(): fin = open( "/Users/moguranosenshi/WorkSpace/100knock2015/kajiwara/data/neko.txt.mecab", "r") morph_lists = mogura.get_morphs(fin) fin.close() word2freq = mogu_count.word_count(morph_lists) plot.plot(range(len(word2freq.keys())), [ freq for word, freq in sorted( word2freq.items(), key=lambda x: x[1], reverse=True) ]) plot.xscale("log") plot.yscale("log") plot.show()
def main(): num = 10 fin = open( "/Users/moguranosenshi/WorkSpace/100knock2015/kajiwara/data/neko.txt.mecab", "r") morph_lists = mogura.get_morphs(fin) fin.close() word2freq = mogu_count.word_count(morph_lists) plot.bar(range(1, num + 1), [ freq for word, freq in sorted( word2freq.items(), key=lambda x: x[1], reverse=True) ][:num], align="center") plot.xticks(range(1, num + 1), [ word.decode("utf-8") for word, freq in sorted( word2freq.items(), key=lambda x: x[1], reverse=True) ][:num]) plot.show()