Review chat replies through cognitive gateway
CI / test (push) Successful in 1m5s
CI / test (pull_request) Successful in 1m0s

This commit is contained in:
m
2026-08-25 03:49:12 +03:00
parent e81411c4a4
commit 34c0e7a0f4
7 changed files with 119 additions and 9 deletions
+2 -2
View File
@@ -129,7 +129,7 @@ func FallbackText(act interaction.SpeechAct) string {
func PreferredAssistantName(message string) string {
tokens := semanticTokens(message)
for index, token := range tokens {
if !containsStem(token, "называ", "зов", "имен") {
if !containsStem(token, "называ", "назов", "зов", "имен") {
continue
}
for _, candidate := range tokens[index+1:] {
@@ -349,7 +349,7 @@ func semanticScores(tokens []string, hasQuestionMark bool, explicitCorrection bo
func preferredNameFromTokens(tokens []string) bool {
for index, token := range tokens {
if !containsStem(token, "называ", "зов", "имен") {
if !containsStem(token, "называ", "назов", "зов", "имен") {
continue
}
for _, candidate := range tokens[index+1:] {
+3
View File
@@ -195,6 +195,9 @@ func TestNamingPreferenceIsSemanticAndProducesNaturalAcceptance(t *testing.T) {
if name := PreferredAssistantName("я буду называть тебя Дед, запомни ты дед"); name != "Дед" {
t.Fatalf("expected extracted assistant name, got %q", name)
}
if name := PreferredAssistantName("я назову тебя дед, запомни"); name != "Дед" {
t.Fatalf("expected conversational name form to be extracted, got %q", name)
}
if !IsIdentityInquiry("ты кто?") || !IsIdentityInquiry("как тебя зовут") {
t.Fatal("identity variants should be recognized")
}