`textstat <https://pypi.python.org/pypi/textstat/>`__ΒΆ

pip install textstat

Python package to calculate statistics from text, which helps to decide readability, complexity and grade level of a particular corpus.
[1]:
    from articles import *; from pandas import *; o = __name__ == '__main__'
    if o:
        %load_ext literacy
[2]:
    from textstat.textstat import textstat
    measures = a[{
        k: f for k in dir(textstat) if not k.startswith('_') for f in [getattr(textstat, k)] if callable(f)
    }]
from textstat.textstat import textstat
measures = a[{
    k: f for k in dir(textstat) if not k.startswith('_') for f in [getattr(textstat, k)] if callable(f)
}]

Playing games has always been thought to be important to the development of well-balanced and creative children; however, what part, if any, they should play in the lives of adults has never been researched that deeply. I believe that playing games is every bit as important for adults as for children. Not only is taking time out to play games with our children and other adults valuable to building interpersonal relationships but is also a wonderful way to release built up tension.

[3]:
    if o:
        df = a.Path().read_text().loads()[this()['cells']][DataFrame](
            __import__('Untitled183').__file__)
        df.source = df.source.apply('\n'.join)
        df = df[df.cell_type == 'markdown'].source.apply(measures).apply(Series).pipe(lambda df_: concat([df, df_], axis=1))
    o and df.T
[3]:
0 1 2 3 4 5
cell_type markdown code code markdown code code
execution_count NaN 11 2 NaN 10 NaN
metadata {} {} {} {} {} {'collapsed': True}
outputs NaN [{'metadata': {}, 'output_type': 'display_data... [{'metadata': {}, 'output_type': 'display_data... NaN [{'execution_count': 10, 'metadata': {}, 'outp... []
source # [`textstat`](https://pypi.python.org/pypi/te... from articles import *; from pandas import... from textstat.textstat import textstat\n\n... Playing games has always been thought to be im... \n\n if o: \n\n df = a.Path().re...
automated_readability_index 29.1 NaN NaN 15.5 NaN NaN
avg_letter_per_word 8.17 NaN NaN 4.93 NaN NaN
avg_sentence_length 24 NaN NaN 27.3 NaN NaN
avg_sentence_per_word 0.04 NaN NaN 0.04 NaN NaN
avg_syllables_per_word 2.2 NaN NaN 1.5 NaN NaN
char_count 196 NaN NaN 404 NaN NaN
coleman_liau_index 30.4 NaN NaN 11.61 NaN NaN
dale_chall_readability_score 13.38 NaN NaN 10.57 NaN NaN
difficult_words 13 NaN NaN 29 NaN NaN
flesch_kincaid_grade 19.7 NaN NaN 12.8 NaN NaN
flesch_reading_ease -3.64 NaN NaN 52.23 NaN NaN
gunning_fog 33.2667 NaN NaN 27.0663 NaN NaN
lexicon_count 24 NaN NaN 82 NaN NaN
linsear_write_formula 17 NaN NaN 15 NaN NaN
polysyllabcount 4 NaN NaN 4 NaN NaN
sentence_count 1 NaN NaN 3 NaN NaN
smog_index 0 NaN NaN 9.7 NaN NaN
syllable_count 53.1 NaN NaN 122.4 NaN NaN
text_standard 29th and 30th grade NaN NaN 9th and 10th grade NaN NaN