Files
Maven/internal/router/singletoken_test.go
T
kami 29329b5f0e router: a Russian verb is a whole sentence, not thin evidence
The clarify gate thinned any one-word utterance to 0.3 confidence, which
trips the stage-3 gate and comes back as "не совсем поняла". That is an
English intuition. Russian packs subject, tense and gender into one word,
so "поужинал" is a complete report and "привет" a complete greeting, and
both got clarified.

thinSingleToken keeps the rule for bare nominals, where it is real ("вода"
is a fact-or-query coin flip), and spares two classes: a closed lexicon of
social and control singles, and any token carrying a verb ending. Both
tests are offline.

Fixture: false clarifies 3 → 2, intent-only 74.0% → 75.3%, full accuracy
unchanged at 70.1%, missed clarify still 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TrVSBKe3RFDF4fGYKWYQnX
2026-08-01 21:29:21 +04:00

34 lines
1.1 KiB
Go

package router
import "testing"
func TestThinSingleTokenThinsBareNominals(t *testing.T) {
// The case the rule exists for: one noun, no way to tell what was asked.
for _, w := range []string{"вода", "бэкап", "нексус", "почта", "backup"} {
if !thinSingleToken(w) {
t.Errorf("thinSingleToken(%q) = false, want true", w)
}
}
}
func TestThinSingleTokenSparesCompleteUtterances(t *testing.T) {
// Regression: every one of these used to be answered with
// "не совсем поняла — можешь переформулировать?".
for _, w := range []string{
"привет", "Привет!", "спасибо", "да", "нет", "стоп", "hello", "yes",
"поужинал", "проснулась", "устал", "выспался", "договорились",
} {
if thinSingleToken(w) {
t.Errorf("thinSingleToken(%q) = true, want false", w)
}
}
}
func TestThinSingleTokenIgnoresMultiWord(t *testing.T) {
for _, s := range []string{"выпил воды", "что там с бэкапом", ""} {
if thinSingleToken(s) {
t.Errorf("thinSingleToken(%q) = true, want false", s)
}
}
}