Voynich Master Archive - Volume 04 - Pages 3001-4000
French Verne control text at the start of the file. Later pages are other control texts, workspace supplements, table previews, and a closing report.
PDF page 496 of 1000. Catalog page range 3001-4000.
Extracted text
Voynich Complete Reproducibility Compendium - 2026-08-28 Page 3495
archive/local/external_voynich_units/voynich_decipherme
nt_repro_bundle/decipherment_attack_v6/validate_synthe
tics.py
SHA-256: 84c63abd3a5a35d61f404945c0606426e9c9122650928f85df471d2d4e57878a | 6,978 bytes | workspace supplement
#!/usr/bin/env python3
"""End-to-end validation of the BPE -> Brown -> substitution attack pipeline
on synthetic homophonic ciphers of Caesar (Latin), with ground truth.
Configs vary homophones per letter (2/3/5), group-length mix, and the
homophone-choice process (iid weighted vs deterministic rotation).
The attack LM is Cicero (different Latin text); German is the wrong-language
contrast. Metrics: class/letter NMI, attacked-vs-truth mapping agreement,
and the language-match index.
"""
from __future__ import annotations
import json, math, random, sys
from collections import Counter, defaultdict
from pathlib import Path
import numpy as np
HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE))
from attack_lib import (letters_of, build_lms, pipeline_classes, class_arrays,
attack, heldout_bits, match_index, truncate)
rng = random.Random(20260809)
OUT = HERE / "output"
OUT.mkdir(exist_ok=True)
ALPH = "abcdefghijklmnopqrst"
TARGET = 120000
def caesar_lines(per_line=9):
s = letters_of("latin")
# rebuild rough word structure for line-making: split every ~6 letters is
# wrong; instead re-read with word boundaries
import re as _re
from attack_lib import LM_DIR, _strip_gutenberg, _deaccent
t = ""
t = _strip_gutenberg((LM_DIR / "caesar_la.txt").read_text(
encoding="utf-8", errors="replace"))
t = _deaccent(t.lower()).replace("v", "u").replace("j", "i")
words = _re.findall(r"[a-z]+", t)
return [words[i:i + per_line] for i in range(0, len(words), per_line)]
def make_tables(letters, n_var, lens):
used, tab = set(), {}
for i, ch in enumerate(letters):
L = lens(i)
vs, tries = [], 0
while len(vs) < n_var:
tries += 1
if tries > 2000: # length class exhausted -> widen the group
L += 1
tries = 0
g = "".join(rng.choice(ALPH) for _ in range(L))
if g not in used:
used.add(g)
vs.append(g)
tab[ch] = vs
return tab
def encipher(lines, tab, choice):
state = defaultdict(int)
out_lines, prov = [], {}
for ln in lines:
row = []
for w in ln:
if w not in prov:
prov[w] = [] # list of encodings used; store first only
groups = []
for ch in w:
vs = tab[ch]
if choice == "rot":
g = vs[state[ch] % len(vs)]
state[ch] += 1
else:
weights = [0.6, 0.3, 0.1, 0.06, 0.04][:len(vs)]
g = rng.choices(vs, weights=weights)[0]
groups.append((ch, g))
row.append("".join(g for _, g in groups))
prov[row[-1]] = [(ch, len(g)) for ch, g in groups]
out_lines.append(row)
return out_lines, prov