You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import argparse"""convert fairseq's output to plain text that have no extra information"""if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--input", type=str, required=True, help="plain text") # nargs="+", parser.add_argument("--output", type=str, required=True, ) args = parser.parse_args() file_out = open(args.output, "wt", encoding="utf-8") with open(args.input, "rt", encoding='utf-8') as _file: for line in _file: seg_list = line.split('\t') if seg_list[0][0:2] == 'H-': file_out.write(seg_list[2]) # file_out.write('\n') file_out.close()