From b4df695f576ac8544ede3d9f9bfe6fb61fa8e45b Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 8 Jun 2026 03:07:40 -0400 Subject: [PATCH] Family inspector + strength-as-saturation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #4: caret in a colored word names its family in the readout — "rhymes ay t — night, light, flight". The colors stop being a mystery. #5: slant rhymes render at 62% of a perfect rhyme's fill, so the page shows match strength, not just match presence. Co-Authored-By: Claude Opus 4.8 (1M context) --- app.py | 4 +++- static/index.html | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 194f9a1..516e73a 100644 --- a/app.py +++ b/app.py @@ -1238,7 +1238,9 @@ def analyze(draft: Draft): color = min(avail, key=lambda c: (usage[c], c)) usage[color] += 1 chosen.append(color) - groups_out.append({"id": gid, "color": color, "slant": g["slant"]}) + sound = re.sub(r"^[a-z0-9]+:", "", g["key"]).replace("|", " ").lower() + groups_out.append({"id": gid, "color": color, "slant": g["slant"], + "sound": sound}) # stanza rhyme schemes from line-ending groups: the token covering # the most of the line's tail owns the slot — Em rhymes "-cock it", diff --git a/static/index.html b/static/index.html index 0a1a274..807e0f0 100644 --- a/static/index.html +++ b/static/index.html @@ -630,6 +630,7 @@ function render(){ : (p && (focusGid === null || p.g === focusGid)) ? p : (w || p); let alpha = !t.ph ? (t.end ? 34 : 19) : (t.end ? 24 : 14); + if(t.slant) alpha = Math.round(alpha * 0.62); // slant sits back // the caret's family brightens; everything else stays itself if(focusGid !== null && t.g === focusGid){ alpha = Math.min(85, Math.round(alpha * 2.8)); @@ -802,6 +803,13 @@ function buildReadout(){ const shown = sch.slice(0, 16).split('').join(' ') + (sch.length > 16 ? ' …' : ''); parts.push(`scheme ${shown}`); } + if(focusGid !== null && analysis){ + const g = analysis.groups.find(x=>x.id === focusGid); + const fam = [...new Set(analysis.tokens.filter(t=>t.g===focusGid) + .map(t=>analysis.lines[t.l].slice(t.s,t.e).toLowerCase()))]; + if(g && fam.length >= 2) + parts.push(`rhymes ${esc(g.sound)} — ${esc(fam.slice(0,6).join(', '))}`); + } schemeReadout.innerHTML = parts.join('    '); }