Ejemplo n.º 1
0
 def test_finds_highest_order_solution_first(self):
     mc = MarkovChain(self.corpus, 3)
     mc.fit()
     nextw = mc.next_word(['alpha','beta','gamma'])
     self.assertEqual(nextw, 'delta')
Ejemplo n.º 2
0
 def test_second_best_solution_next(self):
     mc = MarkovChain(self.corpus, 3)
     mc.fit()
     # TODO: Make sure it tests for beta delta together first?
     nextw = mc.next_word(['beta','delta'])
     self.assertEqual(nextw, 'alpha')
Ejemplo n.º 3
0
 def test_probs_stop_across_lines(self):
     mc = MarkovChain(self.corpus, 3)
     mc.fit()
     nextw = mc.next_word(['alpha','epsilon'])
     self.assertEqual(nextw, '\n') # Nothing follows epsilon