exec(open('sim6.py').read().split('if __name__')[0]) HASSTRUCT=set(adj.keys()) import json as _j d2=_j.load(open('/Users/timlingo/neuron-memory-backups/snapshot-pre-repair-20260806.json',encoding='utf-8',errors='surrogateescape')) ANYEDGE=set() for e in d2['edges']: ANYEDGE.add(e['from_id']); ANYEDGE.add(e['to_id']) del d2 print("struct=%d anyedge=%d"%(len(HASSTRUCT),len(ANYEDGE)),file=sys.stderr) def run4(pool, nlegs, lim=10): P = HASSTRUCT if pool=='struct' else ANYEDGE res={} for qid,q in gold.items(): v=emb(q['query']); s=M@v; s[~np.isfinite(s)]=-1 L,nmatch=lexleg(qid,q['query']) if nmatch==0: res[qid]=[]; continue ordr=np.argsort(-s) cand=[eids[j] for j in ordr[:3000] if PRINT.match(eids[j] or '')] S=cand[:10] G=[x for x in cand if x in P][:10] seeds=[x for x in L[:3] if x in N] seeds=seeds+[eids[j] for j in ordr[:8] if eids[j] in N and eids[j] not in seeds and PRINT.match(eids[j] or '')] A=assoc(seeds,s,False,'cos') if seeds else [] legs=[L,S,G,A] if nlegs==4 else [L,G,A] res[qid]=inter(legs) return res b,_=run(True,False,False,'cos'); base=score(b,'BASE bm25lex replica') score(run4('struct',4),'I 4leg L,S,G(struct),A',base) score(run4('any',4), 'J 4leg L,S,G(anyedge),A',base) score(run4('struct',3),'K 3leg L,G(struct),A',base) score(run4('any',3), 'L 3leg L,G(anyedge),A',base)