Beispiel #1
0
 def test_english_constants(self):
     lan = LanguageRule().en
     constants = FleschKincaidDifficultyEstimator.get_constants_for_language(lan)
     self.assertEqual(206.835, constants["start"])
     self.assertEqual(1.015, constants["sentence"])
     self.assertEqual(84.6, constants["word"])
Beispiel #2
0
 def test_german_constants(self):
     lan = LanguageRule().de
     constants = FleschKincaidDifficultyEstimator.get_constants_for_language(lan)
     self.assertEqual(180, constants["start"])
     self.assertEqual(1, constants["sentence"])
     self.assertEqual(58.5, constants["word"])
Beispiel #3
0
 def test_discrete_between_80_and_50(self):
     d = FleschKincaidDifficultyEstimator.discrete_difficulty(60)
     self.assertEqual(d, 'MEDIUM')
Beispiel #4
0
 def test_discrete_below_0(self):
     d = FleschKincaidDifficultyEstimator.discrete_difficulty(-10)
     self.assertEqual(d, 'HARD')
Beispiel #5
0
 def test_discrete_above_80(self):
     d = FleschKincaidDifficultyEstimator.discrete_difficulty(100)
     self.assertEqual(d, 'EASY')
Beispiel #6
0
 def test_discrete_80(self):
     d = FleschKincaidDifficultyEstimator.discrete_difficulty(80)
     self.assertEqual(d, 'MEDIUM')
Beispiel #7
0
 def test_normalized_between_100_and_0(self):
     d = FleschKincaidDifficultyEstimator.normalize_difficulty(50)
     self.assertEqual(d, 0.5)
Beispiel #8
0
 def test_normalized_below_0(self):
     d = FleschKincaidDifficultyEstimator.normalize_difficulty(-10)
     self.assertEqual(d, 1)
Beispiel #9
0
 def test_recognized_by_flesch_kincaid(self):
     name = "flesch-kincaid"
     self.assertTrue(FleschKincaidDifficultyEstimator.has_custom_name(name))
Beispiel #10
0
 def test_normalized_100(self):
     d = FleschKincaidDifficultyEstimator.normalize_difficulty(100)
     self.assertEqual(d, 0)
Beispiel #11
0
 def test_recognized_by_FKIndex(self):
     name = "FKIndex"
     self.assertTrue(FleschKincaidDifficultyEstimator.has_custom_name(name))
Beispiel #12
0
    def test_german_hard(self):
        lan = LanguageRule().de
        d = FleschKincaidDifficultyEstimator.estimate_difficulty(DE_HARD_TEXT, lan, self.user)

        self.assertEqual('HARD', d['discrete'])
Beispiel #13
0
    def test_german_medium(self):
        lan = LanguageRule().de
        d = FleschKincaidDifficultyEstimator.estimate_difficulty(DE_MEDIUM_TEXT, lan, self.user)

        self.assertEqual('MEDIUM', d['discrete'])
Beispiel #14
0
    def test_english_hard(self):
        lan = LanguageRule().en
        d = FleschKincaidDifficultyEstimator.estimate_difficulty(E_HARD_TEXT, lan, self.user)

        self.assertEqual(d['discrete'], 'HARD')
Beispiel #15
0
    def test_english_medium(self):
        lan = LanguageRule().en
        d = FleschKincaidDifficultyEstimator.estimate_difficulty(E_MEDIUM_TEXT, lan, self.user)

        self.assertEqual(d['discrete'], 'MEDIUM')