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>
70 lines
1.9 KiB
Go
70 lines
1.9 KiB
Go
package router
|
|
|
|
import "testing"
|
|
|
|
func TestActHasEntityTargetRequiresNamedTargetEvidence(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
dec Decision
|
|
want bool
|
|
}{
|
|
{
|
|
name: "matched function and argument",
|
|
dec: Decision{Intent: IntentAct, Slots: Slots{
|
|
Fn: "restart", HasFn: true, Args: []string{"nginx"}, Text: "restart nginx",
|
|
}},
|
|
want: true,
|
|
},
|
|
{
|
|
name: "model function and target text",
|
|
dec: Decision{Intent: IntentAct, Slots: Slots{
|
|
Fn: "restart", HasFn: true, Text: "перезапусти гитею",
|
|
}},
|
|
want: true,
|
|
},
|
|
{
|
|
name: "matched function alone",
|
|
dec: Decision{Intent: IntentAct, Slots: Slots{
|
|
Fn: "выключи", HasFn: true, Text: "выключи",
|
|
}},
|
|
want: false,
|
|
},
|
|
{
|
|
name: "matched function with politeness only",
|
|
dec: Decision{Intent: IntentAct, Slots: Slots{
|
|
Fn: "выключи", HasFn: true, Args: []string{"пожалуйста"}, Text: "выключи пожалуйста",
|
|
}},
|
|
want: false,
|
|
},
|
|
{
|
|
name: "matched function with anaphora only",
|
|
dec: Decision{Intent: IntentAct, Slots: Slots{
|
|
Fn: "выключи", HasFn: true, Args: []string{"его"}, Text: "выключи его",
|
|
}},
|
|
want: false,
|
|
},
|
|
{
|
|
name: "unmatched entity act",
|
|
dec: Decision{Intent: IntentAct, Slots: Slots{Text: "перезапусти muzick indexer"}},
|
|
want: true,
|
|
},
|
|
{
|
|
name: "unmatched verb alone",
|
|
dec: Decision{Intent: IntentAct, Slots: Slots{Text: "перезапусти"}},
|
|
want: false,
|
|
},
|
|
{
|
|
name: "unresolved demonstrative",
|
|
dec: Decision{Intent: IntentAct, Slots: Slots{Text: "сделай это"}},
|
|
want: false,
|
|
},
|
|
}
|
|
for _, testCase := range cases {
|
|
t.Run(testCase.name, func(t *testing.T) {
|
|
if got := ActHasEntityTarget(testCase.dec); got != testCase.want {
|
|
t.Errorf("ActHasEntityTarget(%+v) = %v, want %v", testCase.dec, got, testCase.want)
|
|
}
|
|
})
|
|
}
|
|
}
|