コード例 #1
0
        void Parser_OnMessageReceived(string input, string ruleName, Module self)
        {
            string[] s = ruleName.Split('|');



            if (s[0] == "speak")
            {
                speech.Speak(input);
            }

            if (s[0] == "execute")
            {
                ruleName = "";

                for (int i = 1; i < s.Length; i++)
                {
                    ruleName += s[i] + "|";
                }

                ruleName = ruleName.Substring(0, ruleName.Length - 1);
                Recognition.Response rec = Parse(input, ruleName);
                self.SendData(rec.data);
                addResponse(rec);
            }


            Recognition.Response r = new Recognition.Response();
            r.text     = input;
            r.grammars = new Grammar[0];

            addResponse(r);
        }
コード例 #2
0
 void parser_OnResponse(Recognition.Response res)
 {
     if (res.text != null && res.text != "")
     {
         Reco(res.text, Attention);
     }
     try
     {
         rec.UnloadAllGrammars();
     }
     catch
     { }
     Grammar[] g = res.grammars;
     if (g == null || g.Length == 0)
     {
         LoadGrammar();
     }
     else
     {
         for (int i = 0; i < g.Length; i++)
         {
             rec.LoadGrammar(g[i]);
         }
     }
 }
コード例 #3
0
 protected virtual void addResponse(Recognition.Response r)
 {
     OnResponse(r);
 }
コード例 #4
0
ファイル: Addon.cs プロジェクト: jaynal03456/Jarvis
 private Recognition.Response End()
 {
     Recognition.Response r = new Recognition.Response();
     r.grammars = new Grammar[0];
     return(r);
 }