示例#1
0
        public UserIntent getUserIntent(string input, string context)  //tempfunction!! TODO
        {
            UserIntent intent;

            try
            {
                var intentStr = ac.getIntentApiAi(input, context);
                if (intentStr != null)
                {
                    intent = (UserIntent)Enum.Parse(typeof(UserIntent), intentStr.Replace(" ", ""));
                }
                else
                {
                    return(UserIntent.unknown);
                }
            }catch (Exception ex)
            {
                return(UserIntent.unknown);
            }

            return(intent);
        }
        public void getIntentApiAiIntegrationTest()
        {
            //bad
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("בגין אמר לבן גוריון שהערבים כבשו את העיר העתיקה", ""), "Default Fallback Intent");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi(". קללל ברור,בטח", ""), "Default Fallback Intent");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("מצטער אבל אינני מעוניין", ""), "Default Fallback Intent");



            //good
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("בגין אמר לבן גוריון שהערבים כבשו את העיר העתיקה", "QuestionDialog"), "historyAnswer");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("מה אתה אוהב לאכול", ""), "bot_questions");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("מצטער אבל אינני מעוניין", "yesNoQuestionDialog"), "no");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("קללל ברור בטח", "yesNoQuestionDialog"), "yes");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("ממצב גבר?", "GreetingDialog"), "howAreYou");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("תספר לי משהו מעניין", ""), "intresting");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("אתה מכיר בדיחות טובות?", ""), "funny");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("תחזור לתפריט הראשי", ""), "menu");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("להתראות גבר, כל טוב", "farewell"), "goodbye");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("שלום לך, אני יוחאי", "startConv"), "hello");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("וואלה אין לי שמץ", "QuestionDialog"), "dontKnow");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("טוב די מספיק עם השאלות", "LerningDialog"), "stopSession");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("לך תזדיין", ""), "swearword");
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("בוט מסריח", ""), "swearword");

            //ugly
            Assert.AreEqual(outerAPICtrl.getIntentApiAi("", ""), null);
            Assert.AreEqual(outerAPICtrl.getIntentApiAi(null, null), null);
        }