mavend: say the query answers from the file (V-503)

The three daemon tests that pinned a wording ask the entry instead. The eval
scores every query variant on the persona checks, minus hisgender: it reads her
own feminine verb next to "у тебя" as addressing him as a woman.
This commit is contained in:
2026-08-04 01:32:15 +04:00
parent ae8d38fc31
commit 16d94894b7
6 changed files with 54 additions and 38 deletions
+14 -4
View File
@@ -8,8 +8,8 @@ import (
"github.com/kami/maven/internal/phraser"
)
// TestFallbackPersona scores every line in fallbacks_ru_v1.json and
// ack_ru_v1.json on the persona checks the nudges already pass. These lines are
// TestFallbackPersona scores every line in fallbacks_ru_v1.json, ack_ru_v1.json and
// query_ru_v1.json on the persona checks the nudges already pass. These lines are
// heard out loud and they live in a JSON file now, so a reworded variant that
// says "рад" or "вы" would otherwise reach him with nothing in between.
//
@@ -20,22 +20,32 @@ func TestFallbackPersona(t *testing.T) {
if err != nil {
t.Fatalf("LoadFallbacks: %v", err)
}
// No CheckHisGender. It reads a feminine verb near a second-person pronoun
// as addressing him as a woman, which is right for a nudge and wrong here:
// "не знаю — не нашла у тебя такой записи" is her own verb in her own
// sentence. CheckFeminine still holds her side of the rule.
persona := map[string]bool{
CheckLang: true, CheckFeminine: true, CheckHisGender: true,
CheckLang: true, CheckFeminine: true,
CheckAddress: true, CheckCringe: true, CheckLength: true,
}
ack, err := phraser.LoadAcks(rand.NewSource(20260804))
if err != nil {
t.Fatalf("LoadAcks: %v", err)
}
qry, err := phraser.LoadQueries(rand.NewSource(20260804))
if err != nil {
t.Fatalf("LoadQueries: %v", err)
}
variants := append(fb.Variants(), ack.Variants()...)
variants = append(variants, qry.Variants()...)
if len(variants) == 0 {
t.Fatal("no variants — the file loaded empty")
}
for _, v := range variants {
// The placeholders stand for his own words and carry no persona.
body := v
for _, ph := range []string{"{sources}", "{key}", "{value}", "{fn}", "{text}"} {
for _, ph := range []string{"{sources}", "{key}", "{value}", "{fn}", "{text}", "{when}", "{items}",
"{location}", "{temp}", "{condition}", "{tail}"} {
body = strings.ReplaceAll(body, ph, "вода")
}
for _, r := range RunChecks(Case{}, body, "neutral") {