import os import json here = os.path.dirname(os.path.abspath(__file__)) def prepare_json_dataset(): with open(os.path.join(here, "corpus.txt"), "w") as fout: with open(os.path.join(here, "corpus.jsonl"), "r") as fin: for line in fin: line = json.loads(line) fout.write(line["title"] + " " + line["text"] + "\n") prepare_json_dataset()