utils_5.py 303 B

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