a97764c5f7
MavenHelpGrammar keeps "как отменить напоминание" on SourceSelf, where the answer names the command Maven accepts, instead of leaking to search. PublicCurrentVersionGrammar anchors an explicitly current release on SourceWorld and declines first-person ownership. AmbiguousFragmentGrammar refuses filler plus an unresolved demonstrative rather than letting a statistical head invent context. ImplicitElapsedQueryGrammar reads Russian question word order in "давно я не тренировался" as recall; the declarative order stays a statement. ReminderCancellationReportGrammar keeps "я отменил напоминание" in the non-mutating chat lane. CommandProhibitionGrammar routes a direct negative command to a sentinel fn that can never collide with an enabled tool. ActHasEntityTarget stops a bare verb or a demonstrative-only tail from crossing into Nexus. Praxis attention now accepts "что там с X" for the four service names only. taskstatus separates command mood from result words so a first-person report cannot mutate the board. question.go exports the open-question and locative shapes the recall gate reads. --no-verify: master is the working branch this session by the owner's call. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
51 lines
1.8 KiB
Go
51 lines
1.8 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)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCompleteParsedSingleVerbFactNeedsGrammarAndAKey(t *testing.T) {
|
|
if !completeParsedSingleVerbFact(Decision{
|
|
Intent: IntentFact, Utterance: "поужинал", Slots: Slots{Key: "meal", HasKey: true},
|
|
}) {
|
|
t.Fatal("a parsed one-word Russian fact was not complete")
|
|
}
|
|
for _, decision := range []Decision{
|
|
{Intent: IntentFact, Utterance: "вода", Slots: Slots{Key: "water", HasKey: true}},
|
|
{Intent: IntentFact, Utterance: "поужинал"},
|
|
{Intent: IntentQuery, Utterance: "поужинал", Slots: Slots{Key: "meal", HasKey: true}},
|
|
} {
|
|
if completeParsedSingleVerbFact(decision) {
|
|
t.Errorf("incomplete decision was accepted: %+v", decision)
|
|
}
|
|
}
|
|
}
|