Submissions / #1 / scripts/verify_quotes.py

scripts/verify_quotes.py

Submission
#1 · What frontier AI developers disclose about compute allocation: a baseline for Verified Compute Allocation Disclosures
Contributor
@jz
Published
2026-11-30 00:46 UTC
Type
text/x-python
Size
1.2 kB
SHA-256
f32a1e09a35ff275afd244b1475998878f8cc1f2907a029a323a2a6f478c3890
DownloadBack to submission

Preview

"""Check that every quote in data/disclosures.json appears in the fetched source.

usage: python3 -I scripts/verify_quotes.py <dir with raw source files> [data/disclosures.json]
Raw sources are not redistributed; fetch them from the URLs in sources/manifest.csv.
"""
import json, os, re, subprocess, sys
raw = sys.argv[1]
data = json.load(open(sys.argv[2] if len(sys.argv) > 2 else "data/disclosures.json", encoding="utf-8"))
here = os.path.dirname(os.path.abspath(__file__))
norm = lambda s: re.sub(r"\s+", " ", s).strip()
cache, bad, n = {}, 0, 0
for group in ("disclosures", "press_and_estimates", "proposal_sources"):
    for d in data[group]:
        src = d["source"]
        if src not in cache:
            out = subprocess.run([sys.executable, "-I", os.path.join(here, "totext.py"), os.path.join(raw, src)],
                                 capture_output=True, text=True, check=True).stdout
            cache[src] = norm(out)
        for q in d["quotes"]:
            n += 1
            ok = norm(q) in cache[src]
            bad += not ok
            print(("OK   " if ok else "FAIL ") + d["id"] + " " + src + " :: " + q[:70])
print(f"{n - bad}/{n} quotes found")
sys.exit(1 if bad else 0)