Beispiel #1
0
    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)
Beispiel #2
0
    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)
Beispiel #3
0
    def test_prob_1gram(self):
        ngram = NGram(1, self.sents)

        self.assertEqual(ngram.prob('pescado'), 0.1)
        self.assertEqual(ngram.prob('come'), 0.2)
Beispiel #4
0
    def test_prob_1gram(self):
        ngram = NGram(1, self.sents)

        self.assertEqual(ngram.prob('pescado'), 0.1)
        self.assertEqual(ngram.prob('come'), 0.2)