Preserve explicit memory confirmations
This commit is contained in:
@@ -170,6 +170,15 @@ func IsIdentityInquiry(message string) bool {
|
||||
return containsToken(tokens, "зовут") || containsToken(tokens, "имя")
|
||||
}
|
||||
|
||||
// IsExplicitMemoryInstruction recognizes a direct request to retain the
|
||||
// following human-provided context. It deliberately does not interpret the
|
||||
// content as a verified fact: the conversation owner keeps the original
|
||||
// utterance and its provenance.
|
||||
func IsExplicitMemoryInstruction(message string) bool {
|
||||
tokens := semanticTokens(message)
|
||||
return len(tokens) > 0 && containsStem(tokens[0], "запомни", "помни")
|
||||
}
|
||||
|
||||
func BuildDeterministicCandidate(message string, corrects interaction.HumanUtteranceID, millis int64) interaction.SemanticCandidate {
|
||||
id, _ := ids.New()
|
||||
tokens := semanticTokens(message)
|
||||
|
||||
@@ -255,6 +255,12 @@ func TestNamingPreferenceIsSemanticAndProducesNaturalAcceptance(t *testing.T) {
|
||||
if !IsIdentityInquiry("ты кто?") || !IsIdentityInquiry("как тебя зовут") {
|
||||
t.Fatal("identity variants should be recognized")
|
||||
}
|
||||
if !IsExplicitMemoryInstruction("запомни: сокращение — это источник для поиска") {
|
||||
t.Fatal("explicit memory instruction was not recognized")
|
||||
}
|
||||
if IsExplicitMemoryInstruction("что ты помнишь обо мне?") {
|
||||
t.Fatal("memory inventory question must not be treated as an instruction")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMemoryInventoryRequestIsSemantic(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user