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); }
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]); } } }
protected virtual void addResponse(Recognition.Response r) { OnResponse(r); }
private Recognition.Response End() { Recognition.Response r = new Recognition.Response(); r.grammars = new Grammar[0]; return(r); }