From 20f722e5c9a7ee809c456c3a09031a813b7aef70 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 7 Jun 2026 04:19:03 -0400 Subject: [PATCH] Words inside grouped phrases keep word-level rhyme rights MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pass-4 suppression predates fills-only rendering; mind/time now pair even while «all this time» rides its mosaic. Co-Authored-By: Claude Opus 4.8 (1M context) --- app.py | 10 +++------- tests/test_rhymes.py | 9 +++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index 410aff4..efc7dc5 100644 --- a/app.py +++ b/app.py @@ -800,17 +800,13 @@ def analyze(draft: Draft): group_by_vc = gmap_for("vc") # a word inside an already-grouped phrase sits this pass out, # so "door" doesn't fight "door hinge" for the highlight - phrase_spans = defaultdict(list) - for p in phrases: - if id(p) in grouped: - phrase_spans[p["line"]].append((p["start"], p["end"])) + # (words inside grouped phrases used to sit this pass out; with + # fills-only rendering, word and phrase paint coexist — "time" can + # rhyme "mind" even while «all this time» rides a mosaic) by_vc = defaultdict(list) for t in tokens: if id(t) in grouped: continue - if any(s < t["end"] and t["start"] < e - for s, e in phrase_spans[t["line"]]): - continue w = t["word"].lower() if not t["is_end"] and (w in STOPWORDS or w in refrain or len(w) < 2): continue diff --git a/tests/test_rhymes.py b/tests/test_rhymes.py index 6e96282..831c850 100644 --- a/tests/test_rhymes.py +++ b/tests/test_rhymes.py @@ -532,3 +532,12 @@ def test_word_info(): info = word_info(word="tonight") assert info["syl"] == 2 and info["stress"] == "01" assert info["rime"] == "AY T" + + +def test_word_inside_grouped_phrase_still_rhymes(): + # «all this time» rides a mosaic with «lost in my», but the word + # time must still pair with mind at word level + text = ("lost in my mind for a while\n" + "wastin' all this time with style") + group_with(text, "mind", "time") + group_with(text, "while", "style")