예제 #1
0
 def test_bigram_text_possible(self):
     words = text_gen.random_bigram_text('i', self.bigrams, 100).split()
     prev = 'i'
     for i in range(1, len(words)):
         current = words[i]
         self.assertGreaterEqual(self.bigrams[prev][current], 0)
         prev = current
예제 #2
0
 def test_bigram_text_possible(self):
     words = text_gen.random_bigram_text('i', self.bigrams, 100).split()
     prev = 'i'
     for i in range(1, len(words)):
         current = words[i]
         self.assertGreaterEqual(self.bigrams[prev][current], 0)
         prev = current
예제 #3
0
 def test_bigram_text_correct_start(self):
     text = text_gen.random_bigram_text('i', self.bigrams, 10)
     self.assertEqual(text.split()[0], 'i')
     text = text_gen.random_bigram_text('think', self.bigrams, 10)
     self.assertEqual(text.split()[0], 'think')
예제 #4
0
 def test_bigram_text_correct_length(self):
     text = text_gen.random_bigram_text('i', self.bigrams, 10)
     self.assertEqual(len(text.split()), 10)
예제 #5
0
 def test_bigram_text_correct_start(self):
     text = text_gen.random_bigram_text('i', self.bigrams, 10)
     self.assertEqual(text.split()[0], 'i')
     text = text_gen.random_bigram_text('think', self.bigrams, 10)
     self.assertEqual(text.split()[0], 'think')
예제 #6
0
 def test_bigram_text_correct_length(self):
     text = text_gen.random_bigram_text('i', self.bigrams, 10)
     self.assertEqual(len(text.split()), 10)