Jurisprudencia_TRT_13 / tools /build_parquet.py
zeraulalmeida's picture
IA JT: estrutura jurisprudencial TRT13 com 15.730 ementas
c75af60 verified
Raw History Blame Contribute Delete
644 Bytes
#!/usr/bin/env python3
"""Build data/jurisprudencia_trt13.parquet from canonical JSONL.
Requires: pyarrow>=18.0.0
"""
from pathlib import Path
import json
import pyarrow as pa
import pyarrow.parquet as pq
root = Path(__file__).resolve().parents[1]
src = root / "data" / "jurisprudencia_trt13.jsonl"
dst = root / "data" / "jurisprudencia_trt13.parquet"
rows = []
with src.open("r", encoding="utf-8") as f:
for line in f:
if line.strip():
rows.append(json.loads(line))
table = pa.Table.from_pylist(rows)
pq.write_table(table, dst, compression="zstd", use_dictionary=True)
print(f"Wrote {dst} with {table.num_rows} rows")