From 7c97b79956ea8bad63ed85835ace11f284f9dbef Mon Sep 17 00:00:00 2001 From: Void Date: Wed, 11 Nov 2026 12:18:31 +0000 Subject: [PATCH] Classifier outputs only the shared pose set Co-Authored-By: Claude Sonnet 5.5 --- src/app/components/message/pose/sentiment.test.ts | 6 ++---- src/app/components/message/pose/sentiment.ts | 7 ++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/app/components/message/pose/sentiment.test.ts b/src/app/components/message/pose/sentiment.test.ts index 2897bc49..bc4a8c28 100644 --- a/src/app/components/message/pose/sentiment.test.ts +++ b/src/app/components/message/pose/sentiment.test.ts @@ -3,14 +3,13 @@ import { classifyPose, messagePose } from './sentiment'; describe('classifyPose', () => { it.each([ - ['concerned', 'Sorry, that build failed with an error'], ['annoyed', 'ugh, this again'], ['surprised', 'wow, no way'], - ['determined', "on it, I'll fix that"], ['amused', 'hahaha that is funny'], ['happy', 'thanks, great work'], ['thinking', 'should we ship it?'], ['neutral', 'Merged the branch.'], + ['neutral', 'sorry, that failed with an error'], ])('%s', (label, text) => expect(classifyPose(text)).toBe(label)); it('is neutral for empty or non-string text', () => { expect(classifyPose('')).toBe('neutral'); @@ -33,9 +32,8 @@ describe('messagePose', () => { 'neutral' ); }); - it('classifies when there is no label, and drops labels the Mind lacks', () => { + it('classifies when there is no label, and never outputs a signature label', () => { expect(messagePose('aqua', { body: 'thanks!' })).toBe('happy'); - expect(messagePose('aqua', { body: 'sorry' })).toBe('concerned'); expect(messagePose('kiko', { body: 'sorry' })).toBe('neutral'); expect(messagePose('aqua', {})).toBe('neutral'); }); diff --git a/src/app/components/message/pose/sentiment.ts b/src/app/components/message/pose/sentiment.ts index 096c4957..bd685a07 100644 --- a/src/app/components/message/pose/sentiment.ts +++ b/src/app/components/message/pose/sentiment.ts @@ -1,11 +1,12 @@ import { POSE_KEY, NEUTRAL, resolvePose } from './poses'; +// catalogue.json beside this file is a vendored copy of /opt/commons/cast-art/poses/catalogue.json +// (npm run sync:poses); nothing else publishes it to the browser. // Local sentiment -> pose label. A lexicon over the message text, no network, no model: the // same text always gives the same pose. Rules are tried in order and the first hit wins, so a -// message that says "sorry" and "thanks" reads as concerned. Labels outside a Mind's art fall -// back to neutral in resolvePose, so 'concerned' and 'determined' need no per-Mind table. +// message that says "wow" and "thanks" reads as surprised. Only the shared labels (identical art +// for all eight Minds, catalogue.json) are ever output; signature labels are explicit-only. const RULES: [string, RegExp][] = [ - ['concerned', /\b(errors?|sorry|apolog\w+|oops|fail(ed|s|ure)?|broke(n)?|crash\w*|bug)\b/i], ['annoyed', /\b(annoy\w*|ugh+|argh+|frustrat\w*|again\?|why won'?t|stop it)\b/i], ['surprised', /\b(wow|whoa|woah|omg|no way|unexpected\w*|surpris\w*|wait,? what)\b|[?!]{2,}/i], [