def setUp(self):
     model_class_name = ("forte.processors.data_augment.algorithms."
                         "machine_translator.MarianMachineTranslator")
     self.bta = BackTranslationOp(
         configs={
             "prob": 1.0,
             "model_to": model_class_name,
             "model_back": model_class_name,
             "src_language": "en",
             "tgt_language": "fr",
             "device": "cpu"
         })
class TestBackTranslationAugmenter(unittest.TestCase):
    def setUp(self):
        model_class_name = ("forte.processors.data_augment.algorithms."
                            "machine_translator.MarianMachineTranslator")
        self.bta = BackTranslationOp(
            configs={
                "prob": 1.0,
                "model_to": model_class_name,
                "model_back": model_class_name,
                "src_language": "en",
                "tgt_language": "fr",
                "device": "cpu"
            })

    def test_back_translation(self):
        random.seed(0)
        data_pack = DataPack()
        text = "Natural Language Processing has never been made this simple!"
        data_pack.set_text(text)
        sent = Sentence(data_pack, 0, len(text))
        data_pack.add_entry(sent)

        translated_text = "The treatment of natural language " \
                          "has never been easier!"
        assert (translated_text == self.bta.replace(sent)[1])