示例#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"])
示例#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"])
示例#3
0
 def test_discrete_between_80_and_50(self):
     d = FleschKincaidDifficultyEstimator.discrete_difficulty(60)
     self.assertEqual(d, 'MEDIUM')
示例#4
0
 def test_discrete_below_0(self):
     d = FleschKincaidDifficultyEstimator.discrete_difficulty(-10)
     self.assertEqual(d, 'HARD')
示例#5
0
 def test_discrete_above_80(self):
     d = FleschKincaidDifficultyEstimator.discrete_difficulty(100)
     self.assertEqual(d, 'EASY')
示例#6
0
 def test_discrete_80(self):
     d = FleschKincaidDifficultyEstimator.discrete_difficulty(80)
     self.assertEqual(d, 'MEDIUM')
示例#7
0
 def test_normalized_between_100_and_0(self):
     d = FleschKincaidDifficultyEstimator.normalize_difficulty(50)
     self.assertEqual(d, 0.5)
示例#8
0
 def test_normalized_below_0(self):
     d = FleschKincaidDifficultyEstimator.normalize_difficulty(-10)
     self.assertEqual(d, 1)
示例#9
0
 def test_recognized_by_flesch_kincaid(self):
     name = "flesch-kincaid"
     self.assertTrue(FleschKincaidDifficultyEstimator.has_custom_name(name))
示例#10
0
 def test_normalized_100(self):
     d = FleschKincaidDifficultyEstimator.normalize_difficulty(100)
     self.assertEqual(d, 0)
示例#11
0
 def test_recognized_by_FKIndex(self):
     name = "FKIndex"
     self.assertTrue(FleschKincaidDifficultyEstimator.has_custom_name(name))
示例#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'])
示例#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'])
示例#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')
示例#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')