File size: 394 Bytes
6dc344a
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()