97396e5c19ecf3d911f54fdbb9385eac5925983b,nltk/test/unit/model/test_models.py,NgramModelTextGenerationTests,setUp,#NgramModelTextGenerationTests#,365

Before Change


    Using MLE estimator, generate some text.

    def setUp(self):
        self.model = MLENgramModel(self.trigram_counter)

    def test_generate_one_no_context(self):
        generated = self.model.generate_one()
        self.assertIn(generated, self.model.ngram_counter.unigrams)

After Change


class NgramModelTextGenerationTests(unittest.TestCase):
    Using MLE estimator, generate some text.

    def setUp(self):
        vocab = NgramModelVocabulary(["a", "b", "c", "d", "z", "<s>", "</s>"], unk_cutoff=1)
        training_text = [list("abcd"), list("egadbe")]
        self.model = MleLanguageModel(3, vocabulary=vocab)
        self.model.fit(training_text)

    def test_generate_one_no_context(self):
        generated = self.model.generate_one()
        self.assertIn(generated, self.model.counts.unigrams)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 15

Instances


Project Name: nltk/nltk
Commit Name: 97396e5c19ecf3d911f54fdbb9385eac5925983b
Time: 2018-08-16
Author: ilia.kurenkov@gmail.com
File Name: nltk/test/unit/model/test_models.py
Class Name: NgramModelTextGenerationTests
Method Name: setUp


Project Name: nltk/nltk
Commit Name: 7c413a8a42ebdbc455e9f525a4f761b843e40c83
Time: 2018-08-16
Author: ilia.kurenkov@gmail.com
File Name: nltk/test/unit/model/test_models.py
Class Name: MleTrigramModelTests
Method Name: setUp


Project Name: nltk/nltk
Commit Name: 97396e5c19ecf3d911f54fdbb9385eac5925983b
Time: 2018-08-16
Author: ilia.kurenkov@gmail.com
File Name: nltk/test/unit/model/test_models.py
Class Name: NgramModelTextGenerationTests
Method Name: setUp


Project Name: nltk/nltk
Commit Name: 7c413a8a42ebdbc455e9f525a4f761b843e40c83
Time: 2018-08-16
Author: ilia.kurenkov@gmail.com
File Name: nltk/test/unit/model/test_models.py
Class Name: MleBigramModelTests
Method Name: setUp