from pathlib import Path | |
import pandas as pd | |
file_names = ["./raw/dev.json", "./raw/test.json", "./raw/train.json"] | |
for file_name in file_names: | |
# Read the JSON file into a DataFrame | |
df = pd.read_json(file_name) | |
# Convert the DataFrame to JSON Lines and write to a file_name | |
jsonl_path = "./raw/" + Path(file_name).stem + ".jsonl" | |
df.to_json(jsonl_path, orient="records", lines=True) | |