예제 #1
0
 def test_average_word_heuristic_min_words(self):
     text_5_words = 'Hello this is some text'
     self.assertTrue(
         nlsg.AverageWordHeuristicNLClassifier(
             min_words_per_value=3).classify(text_5_words))
     self.assertFalse(
         nlsg.AverageWordHeuristicNLClassifier(
             min_words_per_value=6).classify(text_5_words))
예제 #2
0
 def test_average_word_heuristic_avg_word_length_check(self):
     text_avg_word_length_3_8 = 'Hello this is some text'
     self.assertFalse(
         nlsg.AverageWordHeuristicNLClassifier(
             avg_word_length_min=3.5,
             avg_word_length_max=3.7).classify(text_avg_word_length_3_8))
     self.assertTrue(
         nlsg.AverageWordHeuristicNLClassifier(
             avg_word_length_min=3.7,
             avg_word_length_max=3.9).classify(text_avg_word_length_3_8))
     self.assertFalse(
         nlsg.AverageWordHeuristicNLClassifier(
             avg_word_length_min=3.9,
             avg_word_length_max=4.1).classify(text_avg_word_length_3_8))
예제 #3
0
 def test_average_word_heuristic_input_with_only_spaces(self):
     self.assertFalse(
         nlsg.AverageWordHeuristicNLClassifier().classify('  '))
예제 #4
0
 def test_average_word_heuristic_empty_input(self):
     self.assertFalse(nlsg.AverageWordHeuristicNLClassifier().classify(''))