Datasets:
import pathlib | |
import orjson | |
with open("compiled.jsonl","wb") as f: | |
for file in pathlib.Path("data").iterdir(): | |
if file.is_file(): | |
pushback = "" | |
for line in file.read_text(encoding="utf-8").split("\n"): | |
if line == "": | |
pushback += "\n" | |
continue | |
if line == line.upper(): | |
continue | |
else: | |
pushback += line + "\n" | |
pushback = pushback.strip() | |
# print(pushback.strip()) | |
f.write(orjson.dumps({"text":pushback}) + b"\n") |