def test_sent_histories_3gram(self): model = MEMM(3, self.tagged_sents) hs = list(model.sent_histories(self.tagged_sents[0])) sent = 'el gato come pescado .'.split() hs2 = [ History(sent, ('<s>', '<s>'), 0), History(sent, ('<s>', 'D'), 1), History(sent, ('D', 'N'), 2), History(sent, ('N', 'V'), 3), History(sent, ('V', 'N'), 4), ] self.assertEqual(hs, hs2)
def test_sent_histories_1gram(self): model = MEMM(1, self.tagged_sents) hs = list(model.sent_histories(self.tagged_sents[0])) sent = 'el gato come pescado .'.split() hs2 = [ History(sent, (), 0), History(sent, (), 1), History(sent, (), 2), History(sent, (), 3), History(sent, (), 4), ] self.assertEqual(hs, hs2)