// Use this for initialization
 public void StartVerbot()
 {
     this.verbot = new Verbot5Engine();
     this.state  = new State();
     kb          = new KnowledgeBase();
     kbi         = new KnowledgeBaseItem();
     Debug.Log("Verbot initialized");
 }
예제 #2
0
        SpeechRecognitionEngine recognizer; // define speech recognition engine


        public ChatBotForm()
        {
            InitializeComponent();

            this.verbot                 = new Verbot5Engine();
            this.state                  = new State();
            this.speaker                = new SpeechSynthesizer();
            this.recognizer             = new SpeechRecognitionEngine();
            this.openFileDialog1.Filter = this.stCKBFileFilter;
            this.Text = this.stFormName;
        }
예제 #3
0
파일: VerbotWinApp.cs 프로젝트: n8wachT/vke
        public VerbotWinApp()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            this.verbot = new Verbot5Engine();
            this.state  = new State();

            this.openFileDialog1.Filter = this.stCKBFileFilter;
            this.Text = this.stFormName;
        }
예제 #4
0
        static void Main(string[] args)
        {
            // verbot variables
            Verbot5Engine     verbot = new Verbot5Engine();
            KnowledgeBase     kb     = new KnowledgeBase();
            KnowledgeBaseItem kbi    = new KnowledgeBaseItem();
            State             state  = new State();

            // build the knowledgebase
            Rule vRule = new Rule();

            vRule.Id = kb.GetNewRuleId();
            vRule.AddInput("Hello", "");
            vRule.AddInput("Hi", "");
            vRule.AddOutput("Hello, World", "", "");
            kb.Rules.Add(vRule);
            string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            // save the knowledgebase
            XMLToolbox xToolbox = new XMLToolbox(typeof(KnowledgeBase));

            xToolbox.SaveXML(kb, path + @"\kbi.vkb");

            // load the knowledgebase item
            kbi.Filename = "kbi.vkb";
            kbi.Fullpath = path + @"\";

            // set the knowledge base for verbot
            verbot.AddKnowledgeBase(kb, kbi);

            state.CurrentKBs.Add(path + @"\kbi.vkb");

            // get input
            Console.WriteLine("Please enter your message");

            while (true)
            {
                string msg = Console.ReadLine();

                // process the reply
                Reply reply = verbot.GetReply(msg, state);
                if (reply != null)
                {
                    Console.WriteLine(reply.AgentText);
                }
                else
                {
                    Console.WriteLine("No reply found.");
                }
            }
        }