Review chat replies through cognitive gateway
This commit is contained in:
@@ -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:] {
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user