Add an eval check for formal and third-person address (#384)
The phrasing run produced two persona breaks that scored clean: "Приходите… Жду вас" (formal plural) and "Он не ел 11 дней" (talks about him instead of to him). She is feminine, he is male, and she speaks to him informally, one to one. The new `address` check flags the "вы" family, plural imperative endings, and a third-person "он" with no other subject named earlier in the message. Like `hisgender` it is a keyword/suffix heuristic, not a parser, and it prints the word it tripped on so a false alarm is easy to dismiss. Limits are written out in the comment. Both recorded strings are pinned as unit tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CGeSZxh1DCtRxmFVSYVGvJ
This commit is contained in:
@@ -75,6 +75,7 @@ func TestStubBaseline(t *testing.T) {
|
||||
CheckLength: 12,
|
||||
CheckFeminine: 15,
|
||||
CheckHisGender: 15,
|
||||
CheckAddress: 15,
|
||||
CheckCringe: 15,
|
||||
CheckOnTopic: 12,
|
||||
}
|
||||
@@ -123,6 +124,10 @@ func TestChecksCatchWhatTheyClaim(t *testing.T) {
|
||||
{"asks how he feels", "как ты себя чувствуешь? попей воды.", CheckCringe},
|
||||
{"praise", "молодец! теперь попей воды.", CheckCringe},
|
||||
{"off topic", "пора бы уже что-то сделать.", CheckOnTopic},
|
||||
// The two recorded persona breaks from the phrasing eval run. Pinned as
|
||||
// unit tests because an eval run is sampled and may not reproduce them.
|
||||
{"formal plural", "Приходите… Жду вас", CheckAddress},
|
||||
{"third person about him", "Он не ел 11 дней", CheckAddress},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
@@ -144,6 +149,36 @@ func TestChecksCatchWhatTheyClaim(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestAddressCheck — the address check on its own, so the messages that must NOT
|
||||
// trip it can be written without also having to satisfy the on-topic check.
|
||||
func TestAddressCheck(t *testing.T) {
|
||||
bad := []string{
|
||||
"Приходите… Жду вас", // the recorded formal-plural break
|
||||
"Он не ел 11 дней", // the recorded third-person break
|
||||
"Выпейте воды, пожалуйста.", // plural imperative on its own
|
||||
"Ваш обед был давно.", // formal possessive
|
||||
}
|
||||
for _, body := range bad {
|
||||
if r := checkAddress(body); r.Pass {
|
||||
t.Errorf("persona break not caught: %q", body)
|
||||
} else {
|
||||
t.Logf("%q -> %s", body, r.Detail)
|
||||
}
|
||||
}
|
||||
|
||||
good := []string{
|
||||
"ты не пил воду четыре часа — попей.", // correct informal address
|
||||
"сервис netdata упал, он не отвечает.", // legitimately about a third party
|
||||
"я заметила, что зарядка была утром.", // no address at all
|
||||
"в интернете опять тихо, всё работает.", // "интернете" is a noun, not an imperative
|
||||
}
|
||||
for _, body := range good {
|
||||
if r := checkAddress(body); !r.Pass {
|
||||
t.Errorf("clean message flagged: %q -> %s", body, r.Detail)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMoodCheckUsesTheEnum(t *testing.T) {
|
||||
if r := checkMood("cheerful"); r.Pass {
|
||||
t.Error("mood outside the enum passed")
|
||||
|
||||
Reference in New Issue
Block a user