/// <summary> /// creates a new command /// </summary> /// <param name="method">the method</param> /// <param name="invokeInstance">the instance to invoke the method on (or null for static methods)</param> public void AddMethod(SpeechMethod method, object invokeInstance) { Dictionary <string, SpeechGroupTuple> langCommands; //create lang if not exists if (Commands.TryGetValue(method.Lang, out langCommands) == false) { langCommands = new Dictionary <string, SpeechGroupTuple>(); Commands.Add(method.Lang, langCommands); } //add the method to the right speech group SpeechGroupTuple speechGroup; if (langCommands.TryGetValue(method.SpeechGroupKey, out speechGroup) == false) { speechGroup = new SpeechGroupTuple(true); langCommands.Add(method.SpeechGroupKey, speechGroup); } //check all synonyms if (method.SpeechNames.Any(p => speechGroup.Commands.ContainsKey(p))) { //there is a synonyme that is already another speech name in this speech group -> invalid throw new Exception("speech dictionary already contains a method with speech name: " + method.SpeechNames + " and key: " + method.Key); } else { var cmd = new SpeechTuple(true, method, invokeInstance); foreach (var speechName in method.SpeechNames) { speechGroup.Commands.Add(speechName, cmd); //same command with different names... } } }
public SpeechTupleArgs(SpeechTuple speechTuple) { this.SpeechTuple = speechTuple; }
public SpeechStream(string recognizedText, SpeechTuple speechTuple, params SpeechParameterStream[] speechParameterStreams) { this.RecognizedText = recognizedText; this.SpeechTuple = speechTuple; this.SpeechParameterStreams = speechParameterStreams.ToList(); }
public SpeechParameterStream(string recognizedParameterNameText, SpeechTuple speechTuple, SpeechParameterInfo speechParameterInfo) { this.RecognizedParameterNameText = recognizedParameterNameText; this.SpeechTuple = speechTuple; this.SpeechParameterInfo = speechParameterInfo; }