Words inside grouped phrases keep word-level rhyme rights

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) <noreply@anthropic.com>
This commit is contained in:
2026-06-07 04:19:03 -04:00
parent 43bbd527a4
commit 20f722e5c9
2 changed files with 12 additions and 7 deletions
+3 -7
View File
@@ -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
+9
View File
@@ -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")