예제 #1
0
    public void IdentifyNotExist()
    {
        var config = new ConfigurationBuilder().AddIntent("foobar", "verbatim", new List <string>()
        {
            "aho"
        }, new Dictionary <string, string>()).Build();
        var identifier = new IntentIdentifier(config);

        Assert.AreEqual(IntentIdentifier.NO_MATCH_EXIST, identifier.Identify("perl is not a researcher.", state).Name);
    }
예제 #2
0
    public void IdentifyIntentWithVerbatimOnCapitalCaseTest()
    {
        var config = new ConfigurationBuilder().AddIntent("foobar", "verbatim", new List <string>()
        {
            "Aho"
        }, new Dictionary <string, string>()).Build();
        var identifier = new IntentIdentifier(config);

        Assert.AreEqual("foobar", identifier.Identify("aho is a researcher.", state).Name);
    }
예제 #3
0
    public void IdentityIntentWithTemplateMatcherOnCapitalCaseTest2()
    {
        var config = new ConfigurationBuilder().AddIntent("ingredient", "template", new List <string>()
        {
            "this is a ${ingredient1}"
        }, new Dictionary <string, string>()
        {
            { "ingredient1", "ingredient" }
        })
                     .AddType("ingredient", new List <string>()
        {
            "potato", "cherry"
        }).Build();
        var identifier = new IntentIdentifier(config);

        Assert.AreEqual("ingredient", identifier.Identify("this is a Potato", state).Name);
    }
예제 #4
0
    public void IdentityNotMatchWithTemplateMatcher()
    {
        var config = new ConfigurationBuilder().AddIntent("ingredient", "template", new List <string>()
        {
            "this is a ${ingredient1}"
        }, new Dictionary <string, string>()
        {
            { "ingredient1", "ingredient" }
        })
                     .AddType("ingredient", new List <string>()
        {
            "potato", "cherry"
        }).Build();
        var identifier = new IntentIdentifier(config);

        Assert.AreEqual(IntentIdentifier.NO_MATCH_EXIST, identifier.Identify("this is a UFO", state).Name);
    }
예제 #5
0
    public void SaveSlotValueToStateWithMatchWithTemplateMatcher()
    {
        var config = new ConfigurationBuilder().AddIntent("ingredient", "template", new List <string>()
        {
            "this is a ${ingredient1}"
        }, new Dictionary <string, string>()
        {
            { "ingredient1", "ingredient" }
        })
                     .AddType("ingredient", new List <string>()
        {
            "potato", "cherry"
        }).Build();
        var identifier = new IntentIdentifier(config);

        Assert.AreEqual("ingredient", identifier.Identify("this is a potato", state).Name);
        Assert.AreEqual("potato", state.GetString("ingredient1"));
    }