How to use the textstat.avg_sentence_length function in textstat

To help you get started, we’ve selected a few textstat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github titipata / scipdf_parser / scipdf / features / text_utils.py View on Github external
"""
    try:
        readability_dict = {
            'flesch_reading_ease': textstat.flesch_reading_ease(text),
            'smog': textstat.smog_index(text),
            'flesch_kincaid_grade': textstat.flesch_kincaid_grade(text),
            'coleman_liau_index': textstat.coleman_liau_index(text),
            'automated_readability_index': textstat.automated_readability_index(text),
            'dale_chall': textstat.dale_chall_readability_score(text),
            'difficult_words': textstat.difficult_words(text),
            'linsear_write': textstat.linsear_write_formula(text),
            'gunning_fog': textstat.gunning_fog(text),
            'text_standard': textstat.text_standard(text), 
            'n_syllable': textstat.syllable_count(text),
            'avg_letter_per_word': textstat.avg_letter_per_word(text),
            'avg_sentence_length': textstat.avg_sentence_length(text)
        }
    except:
        readability_dict = {
            'flesch_reading_ease': None,
            'smog': None,
            'flesch_kincaid_grade': None,
            'coleman_liau_index': None,
            'automated_readability_index': None,
            'dale_chall': None,
            'difficult_words': None,
            'linsear_write': None,
            'gunning_fog': None,
            'text_standard': None, 
            'n_syllable': None,
            'avg_letter_per_word': None,
            'avg_sentence_length': None