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
Ejemplo n.º 2
0
    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
Ejemplo n.º 4
0
    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
Ejemplo n.º 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)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 10
0
 def value_for_text(self, t):
     return ilen(t.sentences)
Ejemplo n.º 11
0
 def value_for_text(self, t):
     pronouns = filter(pos_tagger.tagset.is_pronoun, t.tagged_words)
     return ilen(pronouns) / ilen(t.all_words)
Ejemplo n.º 12
0
 def value_for_text(self, t):
     pronouns = filter(pos_tagger.tagset.is_pronoun, t.tagged_words)
     return ilen(pronouns) / ilen(t.all_words)
Ejemplo n.º 13
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)
Ejemplo n.º 14
0
 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)
Ejemplo n.º 15
0
 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)
Ejemplo n.º 16
0
 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)
Ejemplo n.º 17
0
 def value_for_text(self, t, rp=default_rp):
     return ilen(rp.paragraphs(t))
Ejemplo n.º 18
0
 def value_for_text(self, t, rp=default_rp):
     return ilen(rp.sentences(t))
Ejemplo n.º 19
0
 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)
Ejemplo n.º 21
0
 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)
Ejemplo n.º 22
0
 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)
Ejemplo n.º 23
0
 def value_for_text(self, t):
     adverbs = filter(pos_tagger.tagset.is_adverb, t.tagged_words)
     return ilen(adverbs) / ilen(t.all_words)
Ejemplo n.º 24
0
 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))
Ejemplo n.º 26
0
 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))
Ejemplo n.º 28
0
 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)
Ejemplo n.º 30
0
 def value_for_text(self, t):
     return ilen(t.paragraphs)
Ejemplo n.º 31
0
 def value_for_text(self, t):
     return ilen(filterfalse(pos_tagger.tagset.is_punctuation,
                             t.tagged_words))