File size: 657 Bytes
6479ab1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import argparse
import json
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--input_file_path", type=str, default="", help="path to the originial output json.")
parser.add_argument("--output_file_path", type=str, default="", help="path to where you want to save the processed json.")
args = parser.parse_args()
with open(args.input_file_path , 'r') as f:
data = json.load(f)
transformed_data = [{"questionId": item["question_id"], "answer": item["answer"].replace("</s>", "")} for item in data]
with open(args.output_file_path, 'w') as f:
json.dump(transformed_data, f)
|