def write_to_seq2seq(seq_data, save_file): """ clf_data: List[List[str]] [[src1, tgt1],[src2,tgt2]...] file format: tsv, row: src + tab + tgt """ with open(save_file, 'w', encoding='utf-8') as f: f.writelines("\n".join(["\t".join([str(r) for r in row]) for row in seq_data]))