def test_prob(self): ngram = NGram(2, self.sents) self.assertEqual(ngram.prob('pescado', ['come']), 0.5) self.assertEqual(ngram.prob('salmón', ['come']), 0.5)
def test_prob_1gram(self): ngram = NGram(1, self.sents) self.assertEqual(ngram.prob('pescado'), 0.1) self.assertEqual(ngram.prob('come'), 0.2)