From 2b9395f0eeecff2e465ff34ec38093d38bcd1d0a Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 7 Jun 2026 03:03:48 -0400 Subject: [PATCH] Exact rime lets stopword-anchored phrases pair with words Prufrock's "is it" / "visit" are phone-for-phone identical; identity evidence overrides the anchor rule. Stopword-anchored phrases still can't form groups among themselves. Co-Authored-By: Claude Opus 4.8 (1M context) --- app.py | 10 +++++++--- tests/test_rhymes.py | 8 ++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 2027aad..cd7044e 100644 --- a/app.py +++ b/app.py @@ -493,9 +493,10 @@ def analyze(draft: Draft): for key in rime_keys(t["word"]): by_rime[key].append(t) for p in phrases: - # "bought it" competes; "to me" / "but I" never found anything - if p["word"].split()[0] not in STOPWORDS: - by_rime["p:" + p["rime"]].append(p) + # all phrases compete on exact rime — "is it" matches "visit" + # phone-for-phone; the qualification below stops stopword-anchored + # phrases from pairing with nothing but each other + by_rime["p:" + p["rime"]].append(p) # biggest buckets claim their tokens first, so a word with several # candidate pronunciations joins its best-supported rhyme group. @@ -512,6 +513,9 @@ def analyze(draft: Draft): end_count = sum(t["is_end"] for t in toks) if len(distinct) < 2 and end_count < 2: continue # the same word repeated mid-line isn't a rhyme + if all(" " in t["word"] and t["word"].split()[0] in STOPWORDS + for t in toks): + continue # stopword-anchored phrases need a real-word partner raw_groups.append({"toks": toks, "slant": False, "key": key}) claimed.update(id(t) for t in toks) diff --git a/tests/test_rhymes.py b/tests/test_rhymes.py index b2cecce..85a2cd6 100644 --- a/tests/test_rhymes.py +++ b/tests/test_rhymes.py @@ -383,3 +383,11 @@ def test_mosaic_finds_perfect_members_other_anchor(): text = ("Gambino is a mastermind, fuck a bitch to pass the time\n" "Mass appeal, orange rind, smoke your green, I'm spendin' mine") group_with(text, "mastermind", "rind", "pass the time") + + +def test_eliot_is_it_visit(): + # Prufrock's signature mosaic: phone-for-phone identical rimes + text = ('Oh, do not ask, "What is it?"\n' + "Let us go and make our visit.") + group_with(text, "is it", "visit") + assert scheme(text) == "aa"