File size: 1,756 Bytes
9552b49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""Normalize existing OQAIVAEI release arrays; no research calculations run here."""
from __future__ import annotations

import json
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]


def write_jsonl(name: str, rows: list[dict]) -> None:
    target = ROOT / "data" / f"{name}.jsonl"
    target.parent.mkdir(parents=True, exist_ok=True)
    text = "".join(json.dumps(row, ensure_ascii=False, sort_keys=True, allow_nan=False) + "\n" for row in rows)
    target.write_text(text, encoding="utf-8", newline="\n")
    print(f"{target.relative_to(ROOT)}: {len(rows)} rows")


def main() -> None:
    claims = json.loads((ROOT / "research/docs/claims.json").read_text(encoding="utf-8"))["claims"]
    normalized = []
    for c in claims:
        normalized.append({
            "id": c["id"], "title": c["title"], "contract": c["contract"],
            "proof_status": c["proof_status"], "novelty_status": c["novelty_status"],
            "source": "research/" + c["source"],
            "labels": [p["label"] for p in c["locations"]],
            "theorem_numbers": [p["number"] for p in c["locations"]],
            "printed_pages": [int(p["printed_page"]) for p in c["locations"]],
            "evidence_files": ["research/" + p for p in c["evidence_files"]],
        })
    family = json.loads((ROOT / "research/results/announcement_family.json").read_text(encoding="utf-8"))
    design = json.loads((ROOT / "research/results/codesign_results.json").read_text(encoding="utf-8"))
    write_jsonl("claims", normalized)
    write_jsonl("announcement_family", family["family"])
    write_jsonl("memory_frontier", design["memory_frontier"])
    write_jsonl("divisible_blocks", design["divisible_blocks"])


if __name__ == "__main__":
    main()