emirhanyildirim34555's picture
Publish reviewed research staging to main
343beff verified
Raw History Blame Contribute Delete
1.28 kB
from pathlib import Path
import json,gzip,hashlib,itertools
R=Path(__file__).resolve().parent/'data';m=json.loads((R/'DATA_MANIFEST.json').read_text());counts={};groups={};worlds={}
expected={'train':20000,'validation':2000,'id':2000,'long':2000,'counterfactual':4000}
for row in m['files']:
p=R/row['file'];assert p.stat().st_size==row['bytes'] and hashlib.sha256(p.read_bytes()).hexdigest()==row['sha256']
split=row['file'].split('.')[0];g=set();w=set();ids=set();n=0
with gzip.open(p,'rt',encoding='utf-8') as f:
for line in f:
x=json.loads(line);assert x['split']==split and x['example_id'] not in ids;ids.add(x['example_id']);g.add(x['semantic_group_id']);w.add(x['world_id']);n+=1
assert n==expected[split];counts[split]=n;groups[split]=g;worlds[split]=w
for_other=None
intersections={}
for a,b in itertools.combinations(expected,2):
intersections[a+'|'+b]={'groups':len(groups[a]&groups[b]),'worlds':len(worlds[a]&worlds[b])};assert not any(intersections[a+'|'+b].values())
print(json.dumps({'status':'PASS','rows':counts,'total_rows':sum(counts.values()),'unique_groups':sum(map(len,groups.values())),'split_intersections':intersections,'scope':'Stored file hashes, row schema identifiers and split separation; not retraining or new semantic AST proof'},indent=2))