Voynich Master Archive - Volume 07 - Pages 6001-7000
Test CSV, JSON, and Markdown records. Sections carry a Source path and a SHA-256 line.
PDF page 459 of 1000. Catalog page range 6001-7000.
Extracted text
run_gc_segmentation_recovery_035.py
VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 1
run_gc_segmentation_recovery_035.py
Source: /Voynich/Voynich_FIVE_RECORD_ANONYMOUS_DECOMPRESSION_035_reproducibility.zip!/run_gc_segmentatio
n_recovery_035.py
SHA-256: 515cef52f435413747985144e01fc0a2681dfbdb4897af59357a8da6cdd4241b
!/usr/bin/env python3
"""GC-SEGMENTATION-RECOVERY-035: prospective exact-subsequence recovery of f67r2 A1 label."""
from pathlib import Path
from collections import defaultdict
import hashlib,json,re
import numpy as np,pandas as pd
import run_geometric_expansion_link_030 as g30
import run_fifth_record_prospective_033 as p33
import run_anonymous_record_decompression_032 as d32
ROOT=Path(__file__).resolve().parent;OUT=ROOT/'gc_segmentation_recovery_035';OUT.mkdir(exist_ok=True)
EVENTS=pd.read_csv(ROOT/'external_anchor_attack_018/label_prose_events.csv');GC=ROOT/'crosswalk002_input
s/Voynich_Line_Local_Reproducibility_2026-08-22/data/GC.txt'
FOL='f67r2';LABEL_LINE=56;KEY='A1';ZL_SURFACE=['Q2','A1','B2'];REPS=10000;SEED=20260830
def raw_gc_atoms():
lines=GC.read_text(errors='ignore').splitlines();pat=re.compile(r'^<f67r2\.56,[^>]+>\s*(.*)$')
for s in lines:
m=pat.match(s)
if m:return re.findall(r'[A-Z][0-9a-z]',m.group(1))
return []
def candidate_query(w,qx,qy,coords):
e=EVENTS[(EVENTS.witness==w)&(EVENTS.register=='PROSE')& (EVENTS.folio==FOL)];cand=[]
for line,g in e.groupby('line'):
k=(FOL,int(line))
if k in coords and len(g)>=2:cand.append({'line':int(line),'payloads':list(g.payload),'box':coords[k]}
)
cand=sorted(cand,key=lambda x:x['line']);pos={i for i,c in enumerate(cand) if KEY in c['payloads'] and
any(x!=KEY for x in c['payloads'])}
scores=[]
for c in cand:
_,y0,_,y1=c['box'];scores.append(-abs((y0+y1)/2/837-qy/837))
j=int(np.argmax(scores));c=cand[j];return {'witness':w,'selected_line':c['line'],'hit':j in
pos,'full':c['payloads'],'residual':[x for x in c['payloads'] if
x!=KEY],'vertical_distance':-scores[j],'candidates':len(cand)}
def main():
atoms=raw_gc_atoms();exact=any(atoms[i:i+len(ZL_SURFACE)]==ZL_SURFACE for i in
range(len(atoms)-len(ZL_SURFACE)+1))
lb=g30.aligned_label_boxes();linebs=[b for (f,l,i),b in lb.items() if f==FOL and l==LABEL_LINE]
if not linebs:raise RuntimeError('No physical label-line boxes')
x0=min(b['x'] for b in linebs);x1=max(b['x']+b['w'] for b in linebs);y0=min(b['y'] for b in
linebs);y1=max(b['y']+b['h'] for b in linebs);qx=(x0+x1)/2;qy=(y0+y1)/2
base=g30.aligned_prose_lines();added,_=p33.recover_unrestricted(base);coords={**base,**added};z=candida
te_query('ZL',qx,qy,coords);g=candidate_query('GC',qx,qy,coords)
jac=d32.multiset_jaccard(z['residual'],g['residual']);lcs=d32.lcs_ratio(z['residual'],g['residual']);pa
ssed=bool(exact and z['hit'] and g['hit'] and jac>=.5 and lcs>=.75 and
z['selected_line']==g['selected_line'])
row={'record_id':f'{FOL}:{z["selected_line"]}/{g["selected_line"]}','folio':FOL,'zl_line':z['selected_l
ine'],'gc_line':g['selected_line'],'keys':KEY,'zl_residual':' | '.join(z['residual']),'gc_residual':' |
'.join(g['residual']),'multiset_jaccard':jac,'ordered_lcs_ratio':lcs};pd.DataFrame([row]).to_csv(OUT/'pr
ospective_fifth_record.csv',index=False)
# Append to the four-record ledger and recompute record-pairing null.
old=pd.read_csv(ROOT/'anonymous_record_decompression_032/deduplicated_anonymous_record_ledger.csv');led
ger=pd.concat([old,pd.DataFrame([row])],ignore_index=True) if passed else
old.copy();ledger.to_csv(OUT/'five_record_anonymous_ledger.csv',index=False)
zseq=[x.split(' | ') if isinstance(x,str) and x else [] for x in ledger.zl_residual];gseq=[x.split(' |
') if isinstance(x,str) and x else [] for x in ledger.gc_residual];obs=float(np.mean([d32.multiset_jacca
rd(a,b) for a,b in zip(zseq,gseq)]));rng=np.random.default_rng(SEED);null=[]
for _ in range(REPS):
p=rng.permutation(len(gseq));null.append(float(np.mean([d32.multiset_jaccard(zseq[i],gseq[j]) for i,j