def value_for_text(self, t, rp=default_rp):
        mean_words_per_sentence = WordsPerSentence().value_for_text(t)

        syllables = chain.from_iterable(
            map(syllable_separator.separate, rp.all_words(t)))
        mean_syllables_per_word = ilen(syllables) / ilen(rp.all_words(t))

        flesch = 248.835 - 1.015 * mean_words_per_sentence\
            - 84.6 * mean_syllables_per_word

        return flesch
    def value_for_text(self, t, rp=default_rp):
        mean_words_per_sentence = WordsPerSentence().value_for_text(t)

        syllables = chain.from_iterable(
            map(syllable_separator.separate, rp.all_words(t)))
        mean_syllables_per_word = ilen(syllables) / ilen(rp.all_words(t))

        flesch = 248.835 - 1.015 * mean_words_per_sentence\
            - 84.6 * mean_syllables_per_word

        return flesch
    def value_for_text(self, t):
        mean_words_per_sentence = WordsPerSentence().value_for_text(t)

        syllables = chain.from_iterable(
            map(syllable_separator.separate, t.all_words))
        mean_syllables_per_word = ilen(syllables) / ilen(t.all_words)

        flesch = 164.835 - 1.015 * mean_words_per_sentence\
            - 84.6 * mean_syllables_per_word

        return flesch
    def value_for_text(self, t):
        mean_words_per_sentence = WordsPerSentence().value_for_text(t)

        syllables = chain.from_iterable(
            map(syllable_separator.separate, t.all_words))
        mean_syllables_per_word = ilen(syllables) / ilen(t.all_words)

        flesch = 164.835 - 1.015 * mean_words_per_sentence\
            - 84.6 * mean_syllables_per_word

        return flesch
Example #5
0
    def value_for_text(self, t, rp=default_rp):
        parse_trees = rp.parse_trees(t)
        sent_indices = []

        for tree in parse_trees:
            nps = 0
            mods = 0
            for np in toplevel_NPs(tree):
                nps += 1
                mods += ilen(
                    np.subtrees(lambda s: s.label() in ('ART', 'A', 'ADV')))
            if nps != 0:
                sent_indices.append(mods / nps)

        return sum(sent_indices) / len(sent_indices) if sent_indices else 0
 def value_for_text(self, t, rp=default_rp):
     pronouns = filter(pos_tagger.tagset.is_pronoun, rp.tagged_words(t))
     return ilen(pronouns) / (ilen(rp.all_words(t)) / 1000)
 def value_for_text(self, t):
     return ilen(t.sentences)
 def value_for_text(self, t, rp=default_rp):
     adverbs = [
         t for t in rp.tagged_words(t) if pos_tagger.tagset.is_adverb(t)
         or pos_tagger.tagset.is_denotative_word(t)
     ]
     return ilen(adverbs) / (ilen(rp.all_words(t)) / 1000)
 def value_for_text(self, t):
     function_words = filter(pos_tagger.tagset.is_function_word,
                             t.tagged_words)
     return ilen(function_words) / ilen(t.all_words)
 def value_for_text(self, t):
     return ilen(t.sentences)
 def value_for_text(self, t):
     pronouns = filter(pos_tagger.tagset.is_pronoun, t.tagged_words)
     return ilen(pronouns) / ilen(t.all_words)
 def value_for_text(self, t):
     pronouns = filter(pos_tagger.tagset.is_pronoun, t.tagged_words)
     return ilen(pronouns) / ilen(t.all_words)
 def value_for_text(self, t, rp=default_rp):
     pronouns = filter(pos_tagger.tagset.is_pronoun, rp.tagged_words(t))
     return ilen(pronouns) / (ilen(rp.all_words(t)) / 1000)
 def value_for_text(self, t, rp=default_rp):
     function_words = filter(pos_tagger.tagset.is_function_word,
                             rp.tagged_words(t))
     return ilen(function_words) / (ilen(rp.all_words(t)) / 1000)
 def value_for_text(self, t, rp=default_rp):
     adjectives = filter(pos_tagger.tagset.is_adjective, rp.tagged_words(t))
     return ilen(adjectives) / (ilen(rp.all_words(t)) / 1000)
 def value_for_text(self, t, rp=default_rp):
     adverbs = [t for t in rp.tagged_words(t)
                if pos_tagger.tagset.is_adverb(t)
                or pos_tagger.tagset.is_denotative_word(t)]
     return ilen(adverbs) / (ilen(rp.all_words(t)) / 1000)
 def value_for_text(self, t, rp=default_rp):
     return ilen(rp.paragraphs(t))
 def value_for_text(self, t, rp=default_rp):
     return ilen(rp.sentences(t))
 def value_for_text(self, t):
     return ilen(t.paragraphs)
 def value_for_text(self, t, rp=default_rp):
     function_words = filter(pos_tagger.tagset.is_function_word,
                             rp.tagged_words(t))
     return ilen(function_words) / (ilen(rp.all_words(t)) / 1000)
 def value_for_text(self, t):
     function_words = filter(pos_tagger.tagset.is_function_word,
                             t.tagged_words)
     return ilen(function_words) / ilen(t.all_words)
 def value_for_text(self, t):
     content_words = filter(pos_tagger.tagset.is_content_word,
                            t.tagged_words)
     return ilen(content_words) / ilen(t.all_words)
 def value_for_text(self, t):
     adverbs = filter(pos_tagger.tagset.is_adverb, t.tagged_words)
     return ilen(adverbs) / ilen(t.all_words)
 def value_for_text(self, t):
     adverbs = filter(pos_tagger.tagset.is_adverb, t.tagged_words)
     return ilen(adverbs) / ilen(t.all_words)
 def value_for_text(self, t, rp=default_rp):
     return ilen(rp.sentences(t))
 def value_for_text(self, t):
     content_words = filter(pos_tagger.tagset.is_content_word,
                            t.tagged_words)
     return ilen(content_words) / ilen(t.all_words)
 def value_for_text(self, t, rp=default_rp):
     return ilen(rp.paragraphs(t))
 def value_for_text(self, t):
     return ilen(
         filterfalse(pos_tagger.tagset.is_punctuation, t.tagged_words))
 def value_for_text(self, t, rp=default_rp):
     adjectives = filter(pos_tagger.tagset.is_adjective, rp.tagged_words(t))
     return ilen(adjectives) / (ilen(rp.all_words(t)) / 1000)
 def value_for_text(self, t):
     return ilen(t.paragraphs)
 def value_for_text(self, t):
     return ilen(filterfalse(pos_tagger.tagset.is_punctuation,
                             t.tagged_words))