How to use the textstat.flesch_reading_ease 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 wyounas / homer / src / homer.py View on Github external
def __init__(self, text):
        self.score = textstat.flesch_reading_ease(text)
github titipata / scipdf_parser / scipdf / features / text_utils.py View on Github external
def compute_readability_stats(text):
    """
    Compute reading statistics of the given text
    Reference: https://github.com/shivam5992/textstat

    Parameters
    ==========
    text: str, input section or abstract text
    """
    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,
github wyounas / homer / homer / utils.py View on Github external
def __init__(self, text):
        self.score = textstat.flesch_reading_ease(text)
        self.difficulty_threshold = 60