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")