#!/usr/bin/env python3 """ Counter-demonstration for shakespeare-enquiry.org (cipher-arguments, Entry 5): an equidistant-letter-sequence (ELS) search on the 1609 Sonnets dedication. Shows that a single-skip ELS rule pulls hundreds of words out of the 146 letters, so "a name drops out" (VERE, HENRY) is the null expectation. Word list: /usr/share/dict/american-english (Debian `wamerican`, SCOWL-derived; includes common proper names). Words length 4-7. Single fixed skip, read forwards or backwards. Transcription is the printed dedication, letters only, V as printed. Edit DED to change the transcription and watch the numbers move. """ import re, os, random DED = ("TO.THE.ONLIE.BEGETTER.OF.THESE.INSVING.SONNETS.MR.W.H.ALL.HAPPINESSE." "AND.THAT.ETERNITIE.PROMISED.BY.OVR.EVER-LIVING.POET.WISHETH.THE." "WELL-WISHING.ADVENTVRER.IN.SETTING.FORTH.T.T.") L = re.sub(r'[^A-Z]', '', DED.upper()) n = len(L) def find_els(target): m = len(target) if m < 2: return None for skip in range(1, (n - 1) // (m - 1) + 1): for start in range(n): fwd = [start + skip * k for k in range(m)] if fwd[-1] < n and ''.join(L[i] for i in fwd) == target: return (start, skip, 'fwd') bwd = [start - skip * k for k in range(m)] if bwd[-1] >= 0 and ''.join(L[i] for i in bwd) == target: return (start, skip, 'bwd') return None def all_els_substrings(lo=4, hi=7): S = set() for skip in range(1, n): for r in range(skip): seq = L[r::skip] for a in range(len(seq)): for m in range(lo, hi + 1): if a + m <= len(seq): sub = seq[a:a + m]; S.add(sub); S.add(sub[::-1]) return S if __name__ == "__main__": print(f"letters: {n}\n{L}\n") print("Named targets (single clean skip, either direction):") for t in ["VERE", "EVER", "HENRY", "OXFORD", "WRIOTHESLEY", "DEVERE"]: print(f" {t:12} {find_els(t)}") wl = "/usr/share/dict/american-english" if os.path.exists(wl): words = {w.strip().upper() for w in open(wl, encoding='latin-1') if w.strip().isalpha() and 4 <= len(w.strip()) <= 7} hits = sorted(all_els_substrings() & words) print(f"\nWord-list words (len 4-7) that drop out as a clean ELS: {len(hits)}") print(f" length >= 5: {len([w for w in hits if len(w) >= 5])}") random.seed(3) print(" random sample:", ", ".join(random.sample(hits, min(30, len(hits))))) else: print(f"\n(no word list at {wl}; skipping the dictionary sweep)")