Expand semantic memory decomposition checks
This commit is contained in:
@@ -181,6 +181,26 @@ func TestDecomposeMarketplaceBrandRequestIntoExecutionAtoms(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecomposeDoesNotInventMutableAliases(t *testing.T) {
|
||||
got := DecomposeTask("найди на WB бренд marka-wear")
|
||||
if got.Source != "" || got.Object != "" || got.NeedsResearch {
|
||||
t.Fatalf("parser invented a mutable alias without memory: %+v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecomposeUsesRememberedAliasesAcrossWordings(t *testing.T) {
|
||||
lexicon := TaskLexicon{
|
||||
ObjectAliases: []TaskLexiconEntry{{Alias: "бренд", Value: "BRAND"}, {Alias: "марку", Value: "BRAND"}},
|
||||
SourceAliases: []TaskLexiconEntry{{Alias: "wb", Value: "WILDBERRIES"}, {Alias: "wildberries", Value: "WILDBERRIES"}},
|
||||
}
|
||||
for _, message := range []string{"найди на WB бренд marka-wear", "поищи марку marka-wear в Wildberries"} {
|
||||
got := DecomposeTaskWithLexicon(message, lexicon)
|
||||
if got.Intent != TaskIntentSearch || got.Object != "BRAND" || got.Source != "WILDBERRIES" || got.Target != "marka-wear" || !got.NeedsResearch {
|
||||
t.Fatalf("remembered aliases failed for %q: %+v", message, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecomposeCreativeRequestDoesNotInventResearch(t *testing.T) {
|
||||
lexicon := TaskLexicon{ObjectAliases: []TaskLexiconEntry{{Alias: "медвед", Value: "IMAGE"}}}
|
||||
got := DecomposeTaskWithLexicon("нарисуй бурого медведя", lexicon)
|
||||
|
||||
Reference in New Issue
Block a user