def generate(self, data_obj):
        data_time_stamp = str(time.time())
        if 'target' not in data_obj or 'source' not in data_obj:
            print("No target or source")
        assert(len(data_obj['target']) == len(data_obj['source']))

        # alignments
        alignments_file = os.path.join(self.tmp_dir, 'align.'+self.time_stamp)
        all_alignments = self.get_alignments(data_obj['source'], data_obj['target'], self.align_model, alignments_file)
        data_obj['alignments'] = all_alignments

        # segmentation
        # call Moses phrase extractor
        command, phrase_table = self.write_command_file(data_obj, alignments_file)
        call(['bash', command])

        # call Moses MT
        moses_config = self.write_moses_config(phrase_table, data_obj['target_file'])
        moses_seg_file_name = os.path.join(self.tmp_dir, 'segmentation.'+self.time_stamp+'.'+data_time_stamp)
        moses_seg_file = open(moses_seg_file_name, 'w')
        src = open(data_obj['source_file'])
        call([os.path.join(self.moses_dir, 'bin/moses'), '-f', moses_config, '-v', '0', '-t'], stdin=src, stdout=moses_seg_file)
        moses_seg_file.close()
        src.close()

        data_obj['segmentation'], data_obj['source_segmentation'] = self.get_segments(data_obj, moses_seg_file_name)

        return data_obj
dataset/ETHPy150Open qe-team/marmot/marmot/representations/segmentation_representation_generator.py/SegmentationRepresentationGenerator.generate/original