@@ -0,0 +1,2541 @@
+from feature import simple%0Aimport graph%0A%0Afrom nltk.corpus import brown%0A%0A%0Adef calc_readability(corpus):%0A    texts = %5B%5D%0A    results = %5B%5D%0A    for fileid in corpus.fileids():%0A        sentlist = brown.sents(fileids=%5Bfileid%5D)%0A        text = ' '.join(%5B ' '.join(ss) for ss in sentlist %5D)%0A        texts.append(text)%0A    for text in texts:%0A        results.append(simple.get_text_stats(text)%5B'read'%5D)%0A    return results%0A%0Aif __name__ == '__main__':%0A    result = calc_readability(brown)%0A%0A    values = %5B float(v%5B'ari'%5D) for v in result %5D%0A    graph.hist('data/ari_hist', values, 'ARI', 'Frequency',%0A               'Frequency of ARI values')%0A%0A    values = %5B float(v%5B'flesch_reading_ease'%5D) for v in result %5D%0A    graph.hist('data/flesch_reading_ease_hist', values, 'Flesch Reading Ease', 'Frequency',%0A               'Frequency of Flesch Reading Ease values')%0A%0A    values = %5B float(v%5B'flesch_kincaid_grade_level'%5D) for v in result %5D%0A    graph.hist('data/flesch_kincaid_grade_level_hist', values, 'Flesch Kincaid Grade Level', 'Frequency',%0A               'Frequency of Flesch Kincaid Grade Level values')%0A%0A    values = %5B float(v%5B'gunning_fog_index'%5D) for v in result %5D%0A    graph.hist('data/gunning_fog_index_hist', values, 'Gunning Fog Index', 'Frequency',%0A               'Frequency of Gunning Fog Index values')%0A%0A    values = %5B float(v%5B'smog_index'%5D) for v in result %5D%0A    graph.hist('data/smog_index_hist', values, 'Smog Index', 'Frequency',%0A               'Frequency of Smog Index values')%0A%0A    values = %5B float(v%5B'coleman_liau_index'%5D) for v in result %5D%0A    graph.hist('data/coleman_liau_index_hist', values, 'Coleman Liau Index', 'Frequency',%0A               'Frequency of Coleman Liau Index values')%0A%0A    values = %5B float(v%5B'lix'%5D) for v in result %5D%0A    graph.hist('data/lix_hist', values, 'LIX', 'Frequency',%0A               'Frequency of LIX values')%0A%0A    values = %5B float(v%5B'rix'%5D) for v in result %5D%0A    graph.hist('data/rix_hist', values, 'RIX', 'Frequency',%0A               'Frequency of RIX values')%0A%0A    indices = %5B'ari', 'flesch_reading_ease', 'flesch_kincaid_grade_level', 'gunning_fog_index', 'smog_index',%0A               'coleman_liau_index', 'lix', 'rix'%5D%0A    seen = %5B%5D%0A    for i in indices:%0A        for j in indices:%0A            if i == j:%0A                continue%0A            key = tuple(sorted(%5Bi, j%5D))%0A            if key in seen:%0A                continue%0A            seen.append(key)%0A            x = %5B float(v%5Bi%5D) for v in result %5D%0A            y = %5B float(v%5Bj%5D) for v in result %5D%0A            graph.scatter('data/%25s-%25s' %25 (i, j), x, y, i, j)

Add readability grapher for brown corpus