def get_alignments(self, src, tg, align_model, align_file):
        alignments = [[[] for j in range(len(tg[i]))] for i in range(len(tg))]
        align_stream = open(align_file, 'w')
        aligner = Aligner(align_model+'.fwd_params', align_model+'.fwd_err', align_model+'.rev_params', align_model+'.rev_err')
        for idx, (src_list, tg_list) in enumerate(zip(src, tg)):
            align_string = aligner.align(' '.join(src_list) + ' ||| ' + ' '.join(tg_list))
            align_stream.write('%s\n' % align_string)
            pairs = align_string.split()
            for p_str in pairs:
                p = p_str.split('-')
                alignments[idx][int(p[1])].append(int(p[0]))
        aligner.close()
        align_stream.close()
        return alignments
dataset/ETHPy150Open qe-team/marmot/marmot/representations/segmentation_representation_generator.py/SegmentationRepresentationGenerator.get_alignments/original