Пример #1
0
    def __init__(self, stats, sentences):
        if stats.num_sentences < 30:
            raise ReadabilityException(
                'SMOG requires 30 sentences. {} found'.format(
                    stats.num_sentences))

        self._stats = stats
        self._smog_stats = self._smog_text_stats(sentences)
Пример #2
0
    def __init__(self, stats, sentences, all_sentences=False):
        """
        Computes the SMOG readability score (Harry McLaughlin, 1969 https://ogg.osu.edu/media/documents/health_lit/WRRSMOG_Readability_Formula_G._Harry_McLaughlin__1969_.pdf)
        If all_sentences is false, computes the score as described in McLaughlin, 1969, using exactly 30 sentences
        If all_sentences is true, adjusts the score to use all sentences in the text
        """
        if stats.num_sentences < 30:
            raise ReadabilityException(
                'SMOG requires 30 sentences. {} found'
                .format(stats.num_sentences))

        self._stats = stats
        self.all_sentences = all_sentences
        if not self.all_sentences:
            self._smog_stats = self._smog_text_stats(sentences)
Пример #3
0
 def __init__(self, stats):
     self._stats = stats
     if stats.num_words < 100:
         raise ReadabilityException('100 words required.')