def test_no_saved_files(self):
     generator = WMTRepresentationGenerator(self.wmt_target, self.wmt_source)
     data_obj = generator.generate()
     self.assertTrue('target' in data_obj)
     self.assertTrue('source' in data_obj)
     self.assertTrue('tags' in data_obj)
     self.assertTrue(len(data_obj['target']) == len(data_obj['source']))
     self.assertTrue(len(data_obj['target']) == len(data_obj['tags']))
示例#2
0
 def test_no_saved_files(self):
     generator = WMTRepresentationGenerator(self.wmt_target,
                                            self.wmt_source)
     data_obj = generator.generate()
     self.assertTrue('target' in data_obj)
     self.assertTrue('source' in data_obj)
     self.assertTrue('tags' in data_obj)
     self.assertTrue(len(data_obj['target']) == len(data_obj['source']))
     self.assertTrue(len(data_obj['target']) == len(data_obj['tags']))
 def test_save_files(self):
     generator = WMTRepresentationGenerator(self.wmt_target, self.wmt_source, tmp_dir=self.tmp_dir, persist=True)
     data_obj = generator.generate()
     target = os.path.join(self.tmp_dir, 'EN_ES.tgt_ann.train.target')
     tags = os.path.join(self.tmp_dir, 'EN_ES.tgt_ann.train.tags')
     source = os.path.join(self.tmp_dir, 'EN_ES.source.train.txt')
     self.assertTrue(os.path.exists(self.tmp_dir) and os.path.isdir(self.tmp_dir))
     self.assertTrue(os.path.exists(target) and os.path.isfile(target))
     self.assertTrue(os.path.exists(tags) and os.path.isfile(tags))
     self.assertTrue(os.path.exists(source) and os.path.isfile(source))
示例#4
0
 def test_save_files(self):
     generator = WMTRepresentationGenerator(self.wmt_target,
                                            self.wmt_source,
                                            tmp_dir=self.tmp_dir,
                                            persist=True)
     data_obj = generator.generate()
     target = os.path.join(self.tmp_dir, 'EN_ES.tgt_ann.train.target')
     tags = os.path.join(self.tmp_dir, 'EN_ES.tgt_ann.train.tags')
     source = os.path.join(self.tmp_dir, 'EN_ES.source.train.txt')
     self.assertTrue(
         os.path.exists(self.tmp_dir) and os.path.isdir(self.tmp_dir))
     self.assertTrue(os.path.exists(target) and os.path.isfile(target))
     self.assertTrue(os.path.exists(tags) and os.path.isfile(tags))
     self.assertTrue(os.path.exists(source) and os.path.isfile(source))