from __future__ import annotations import json from pathlib import Path HERE = Path(__file__).resolve().parent OUT = HERE TTS_UZ = HERE def read_jsonl(path): return [json.loads(line) for line in Path(path).read_text(encoding="utf-8").splitlines() if line.strip()] def write_jsonl(path, rows): Path(path).write_text("".join(json.dumps(r, ensure_ascii=False) + "\n" for r in rows), encoding="utf-8")