edgar_segmenter_artifacts / scripts /00_build_input.py
arthrod's picture
Add files using upload-large-folder tool
1e5748d verified
Raw History Blame Contribute Delete
673 Bytes
"""Segmenter input from the source of truth only: one row per agreement with
id, idx, family_id and html = the SOT's `full_html_content`. Each document is
its own family (fam-<idx>). No other file is read."""
import json
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
rows = []
for line in (ROOT / "segments_with_original_text_2026-09-22.jsonl").open():
r = json.loads(line)
rows.append({"id": f"doc-{r['idx']:04d}", "idx": r["idx"], "family_id": f"fam-{r['idx']:04d}", "html": r["full_html_content"]})
(ROOT / "sample/sot_input.jsonl").write_text("".join(json.dumps(x, ensure_ascii=False) + "\n" for x in rows))
print(len(rows), "documents")