예제 #1
0
        public string GetResponse(Sys.Tool.RequestData RequestData)
        {
            string ResponseString = "";

            //RequestData.QueryResult.Parameters.InquiryType

            //example checks, need to implement better logic checks using truth table
            string question = RequestData.QueryResult.QueryText.ToLower();

            Tool.SearchParameters par = new Tool.SearchParameters();

            par.Action      = RequestData.QueryResult.Parameters.Action + "";
            par.QuestionKey = RequestData.QueryResult.Parameters.QuestionKey + "";
            par.Location    = RequestData.QueryResult.Parameters.Location + "";
            par.InquiryType = RequestData.QueryResult.Parameters.InquiryType + "";
            par.Subject     = RequestData.QueryResult.Parameters.Subject + "";

            if (RequestData.QueryResult.Intent.DisplayName.ToLower().Trim() == "executiveeducationintent")
            {
                ResponseString = KB1.Search(question, par);
            }
            if (RequestData.QueryResult.Intent.DisplayName.ToLower().Trim() == "graduateprogrammeintent")
            {
                ResponseString = KB2.Search(question, par);
            }
            if (RequestData.QueryResult.Intent.DisplayName.ToLower().Trim() == "stackableprogrammeintent")
            {
                ResponseString = KB3.Search(question, par);
            }
            if (RequestData.QueryResult.Intent.DisplayName.ToLower().Trim() == "otherinformationintent")
            {
                ResponseString = KB4.Search(question, par);
            }
            if (ResponseString.Trim() == "")
            {
                switch (question)
                {
                case MasterProgrammeAvailable:
                    ResponseString = "The are a number of masters programme available at ISS NUS. Namely: (1) Master of Technology in Enterprise Business Analytics, (2) Master of Technology in Digital Leadership, (3) Master of Technology in Intelligent Systems, (4) Master of Technology in Software Engineering.";
                    break;

                case ProgrammeAvailableAtISSNUS:
                    ResponseString = "There are two areas of programmes in ISS NUS: (1) Executive Education, (2) Graduate programmes, Stackable programmes are a class of flexible programmes designed for working professionals. You can learn more by visiting <a href='https://www.iss.nus.edu.sg/' target='_bank'>ISS web site</a>.";
                    break;

                case ConductPostGraduateProgramme:
                    ResponseString = "Yes, ISS NUS conducts post graduate programmes each year. They are essentially masters programmes.";
                    break;
                }
            }

            if (ResponseString == "")
            {
                ResponseString = "I am sorry, I do not have a comment at this moment. Can you try again?";
            }
            return(ResponseString);
        }
        public void TestBinaryTree()
        {
            //******************************************************************
            //Test binary tree
            //******************************************************************
            Sys.Tool.Node n = new Sys.Tool.Node("0");
            n.Action.Add("0"); n.InquiryType.Add("0"); n.QuestionKey.Add("0"); n.Subject.Add("0"); n.Location.Add("0");
            n.Value = "value 0"; this.Node = n;

            n = new Sys.Tool.Node("1");
            n.Action.Add("1"); n.InquiryType.Add("1"); n.QuestionKey.Add("1"); n.Subject.Add("1"); n.Location.Add("1");
            n.Value = "value 1"; this.Node.Add(n);

            n = new Sys.Tool.Node("2");
            n.Action.Add("2"); n.InquiryType.Add("2"); n.QuestionKey.Add("2"); n.Subject.Add("2"); n.Location.Add("2");
            n.Value = "value 2"; this.Node.Add(n);

            n = new Sys.Tool.Node("3");
            n.Action.Add("3"); n.InquiryType.Add("3"); n.QuestionKey.Add("3"); n.Subject.Add("3"); n.Location.Add("3");
            n.Value = "value 3"; this.Node.Add(n);

            n = new Sys.Tool.Node("4");
            n.Action.Add("4"); n.InquiryType.Add("4"); n.QuestionKey.Add("4"); n.Subject.Add("4"); n.Location.Add("4");
            n.Value = "value 4"; this.Node.Add(n);

            n = new Sys.Tool.Node("5");
            n.Action.Add("5"); n.InquiryType.Add("5"); n.QuestionKey.Add("5"); n.Subject.Add("5"); n.Location.Add("5");
            n.Value = "value 5"; this.Node.Add(n);

            n = new Sys.Tool.Node("6");
            n.Action.Add("6"); n.InquiryType.Add("6"); n.QuestionKey.Add("6"); n.Subject.Add("6"); n.Location.Add("6");
            n.Value = "value 6"; this.Node.Add(n);

            n = new Sys.Tool.Node("7");
            n.Action.Add("7"); n.InquiryType.Add("7"); n.QuestionKey.Add("7"); n.Subject.Add("7"); n.Location.Add("7");
            n.Value = "value 7"; this.Node.Add(n);

            n = new Sys.Tool.Node("8");
            n.Action.Add("8"); n.InquiryType.Add("8"); n.QuestionKey.Add("8"); n.Subject.Add("8"); n.Location.Add("8");
            n.Value = "value 8"; this.Node.Add(n);

            n = new Sys.Tool.Node("9");
            n.Action.Add("9"); n.InquiryType.Add("9"); n.QuestionKey.Add("9"); n.Subject.Add("9"); n.Location.Add("9");
            n.Value = "value 9"; this.Node.Add(n);

            n = new Sys.Tool.Node("10");
            n.Action.Add("10"); n.InquiryType.Add("10"); n.QuestionKey.Add("10"); n.Subject.Add("10"); n.Location.Add("10");
            n.Value = "value 10"; this.Node.Add(n);

            n = new Sys.Tool.Node("11");
            n.Action.Add("11"); n.InquiryType.Add("11"); n.QuestionKey.Add("11"); n.Subject.Add("11"); n.Location.Add("11");
            n.Value = "value 11"; this.Node.Add(n);

            n = new Sys.Tool.Node("12");
            n.Action.Add("12"); n.InquiryType.Add("12"); n.QuestionKey.Add("12"); n.Subject.Add("12"); n.Location.Add("12");
            n.Value = "value 12"; this.Node.Add(n);

            n = new Sys.Tool.Node("13");
            n.Action.Add("13"); n.InquiryType.Add("13"); n.QuestionKey.Add("13"); n.Subject.Add("13"); n.Location.Add("13");
            n.Value = "value 13"; this.Node.Add(n);

            n = new Sys.Tool.Node("14");
            n.Action.Add("14"); n.InquiryType.Add("14"); n.QuestionKey.Add("14"); n.Subject.Add("14"); n.Location.Add("14");
            n.Value = "value 14"; this.Node.Add(n);

            //Search - Level 3 of Node B (8) - See Slide on "Custom knowledge base struture"
            Tool.SearchParameters pp = new Tool.SearchParameters();
            pp.Action = "8"; pp.QuestionKey = "8"; pp.Location = ""; pp.InquiryType = "8"; pp.Subject = "8";
            string ff = Search("", pp); //Passed

            //Search - Level 3 of Node B (10) - See Slide on "Custom knowledge base struture"
            pp        = new Tool.SearchParameters();
            pp.Action = "10"; pp.QuestionKey = "10"; pp.Location = ""; pp.InquiryType = "10"; pp.Subject = "10";
            ff        = Search("", pp); //Passed

            //Search - Level 3 of Node A (13) - See Slide on "Custom knowledge base struture"
            pp        = new Tool.SearchParameters();
            pp.Action = "13"; pp.QuestionKey = "13"; pp.Location = ""; pp.InquiryType = "13"; pp.Subject = "13";
            ff        = Search("", pp); //Passed

            //Search - Level 2 of Node A (5) - See Slide on "Custom knowledge base struture"
            pp        = new Tool.SearchParameters();
            pp.Action = "5"; pp.QuestionKey = "5"; pp.Location = ""; pp.InquiryType = "5"; pp.Subject = "5";
            ff        = Search("", pp); //Passed
            //******************************************************************
        }