示例#1
0
 def test_later_words_prob_is(self):
     '''Test later_word_probability for is'''
     later_words = later_words_probabilities(TEST_TEXT1, 'is', 2)
     self.assertEqual(2, len(later_words))
     self.assertEqual(TWO_THIRDS, later_words[0]['a'])
     self.assertEqual(ONE_THIRD, later_words[0]['not'])
     self.assertEqual(TWO_THIRDS, later_words[1]['a'][0]['test'])
     self.assertEqual(ONE_THIRD, later_words[1]['a'][0]['mess'])
     self.assertEqual(1, later_words[1]['not'][0]['a'])
示例#2
0
 def test_later_words_prob_a(self):
     '''Test later_word_probability for a'''
     later_words = later_words_probabilities(TEST_TEXT1, 'a', 1)
     self.assertEqual(1, len(later_words))
     self.assertEqual(TWO_THIRDS, later_words[0]['test'])
     self.assertEqual(ONE_THIRD, later_words[0]['mess'])