import json,sys SRC="/Users/timlingo/neuron-memory-backups/snapshot-pre-repair-20260806.json" TSV,OUT=sys.argv[1],sys.argv[2] emb={} for line in open(TSV,encoding='utf-8',errors='surrogateescape'): p=line.rstrip("\n").rsplit("\t",1) if len(p)==2 and p[1].count(",")>100: emb[p[0]]=p[1] print("vectors",len(emb),flush=True) d=json.load(open(SRC,encoding='utf-8',errors='surrogateescape')) hit=0 for n in d["nodes"]: v=emb.get(n.get("id") or "") if v: n["emb"]=v; hit+=1 print("attached",hit,"of",len(d["nodes"]),flush=True) with open(OUT,"w",encoding='utf-8',errors='surrogateescape') as f: json.dump(d,f,ensure_ascii=False) print("wrote",OUT,flush=True)