public Dialog GetDialogForInput(String input) { if (IsValid) { RecognitionResult result = _recoEngine.EmulateRecognize(input); return(new Dialog(ConvertResultToDictionary(result), result.Text)); } return(null); }
void xmppCon_OnMessage(object sender, agsXMPP.protocol.client.Message msg) { try { // ignore empty messages (events) if (msg.Body == null || oldMmsg == msg || msg.Type == agsXMPP.protocol.client.MessageType.error) { return; } oldMmsg = msg; DataSet dsResults = new DataSet(); //Build a List of all Users to identify who is sending the message. dsResults = OSAESql.RunSQL("SELECT DISTINCT(object_name) FROM osae_v_object_property WHERE property_name = 'JabberID' and property_value = '" + msg.From.Bare + "' ORDER BY object_name"); gCurrentUser = dsResults.Tables[0].Rows[0][0].ToString(); OSAEObjectPropertyManager.ObjectPropertySet(gCurrentUser, "Communication Method", "Jabber", gCurrentUser); gCurrentAddress = msg.From.Bare; RecognitionResult rr = oRecognizer.EmulateRecognize(msg.Body); if (rr == null) { if (gDebug) { Log.Debug("INPUT: No Matching Pattern found!"); } } } catch (Exception ex) { Log.Error("Error in _OnMessage!", ex); } }
void speak_now_Click(Object sender, EventArgs e) { textBox.Text = "JHEre"; sre = new SpeechRecognitionEngine(); // sre.SetInputToWaveFile(@"c:\Test\Colors.wav"); // Create a simple grammar that recognizes "red", "green", or "blue". Choices colors = new Choices(); colors.Add(new string[] { "red", "green", "blue" }); // Create a GrammarBuilder object and append the Choices object. GrammarBuilder gb = new GrammarBuilder(); gb.Append(colors); // Create the Grammar instance and load it into the speech recognition engine. Grammar g = new Grammar(gb); sre.LoadGrammar(g); sre.EmulateRecognizeCompleted += Sre_EmulateRecognizeCompleted; sre.EmulateRecognize("red"); }
public Listen() // ecoute l'user parler { // Create an in-process speech recognizer for the en-US locale. using ( SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine( new System.Globalization.CultureInfo("fr"))) { // crée et charge la grammaire grammar. this.vocabulaire.lireFichierXML(); // Console.WriteLine(vocabulaire.recupererVocabulaire().Enabled); recognizer.LoadGrammar(this.vocabulaire.recupererVocabulaire()); // Add un event for the speech recognized event. recognizer.EmulateRecognize("allume"); recognizer.SpeechRecognized += new EventHandler <SpeechRecognizedEventArgs>(recognizer_SpeechRecognized); // Configure input to the speech recognizer. recognizer.SetInputToDefaultAudioDevice(); // Start asynchronous, continuous speech recognition. recognizer.RecognizeAsync(RecognizeMode.Multiple); // Keep the console window open. while (true) { Console.ReadLine(); } } }
static void EmulateRecognize() { _recognizer = new SpeechRecognitionEngine(); _recognizer.LoadGrammar(new Grammar(new GrammarBuilder("emulate speech"))); // load "emulate speech" grammar _recognizer.SpeechRecognized += _emulateRecognize_SpeechRecognized; _recognizer.EmulateRecognize("emulate speech"); }
void xmppCon_OnMessage(object sender, agsXMPP.protocol.client.Message msg) { try { // ignore empty messages (events) if (msg.Body == null || oldMmsg == msg || msg.Type == agsXMPP.protocol.client.MessageType.error) { return; } oldMmsg = msg; string[] jIDRaw = msg.From.ToString().Split('/'); string jID = jIDRaw[0]; OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByPropertyValue("JabberID", jID); if (objects != null) { foreach (OSAEObject oObj in objects) { if (oObj.Alias.Length > 0) { gCurrentUser = oObj.Alias; } else { gCurrentUser = oObj.Name; } } } else { Log.Info("Message from Unknown address: " + jID); } if (gDebug) { Log.Debug("Current User set to: " + gCurrentUser); } OSAEObjectPropertyManager.ObjectPropertySet(gCurrentUser, "Communication Method", "Jabber", gAppName); gCurrentAddress = jID; if (msg.Body.EndsWith("?") || msg.Body.EndsWith("!") || msg.Body.EndsWith(".")) { msg.Body = msg.Body.Substring(0, msg.Body.Length - 1); } RecognitionResult rr = oRecognizer.EmulateRecognize(msg.Body); if (rr == null) { if (gDebug) { Log.Debug("INPUT: No Matching Pattern found!"); } } } catch (Exception ex) { Log.Error("Error in _OnMessage!", ex); } }
public void LoadFolder(string folderPath) { Interpreter interpreter = new Interpreter(); interpreter.AddFilesFromDirectory(folderPath); interpreter.Compile(); foreach (VCGrammar grammar in interpreter.CompiledGrammar) { speechRecognitionEngine.LoadGrammar(grammar); } speechRecognitionEngine.RequestRecognizerUpdate(); speechRecognitionEngine.EmulateRecognize("hello"); }
private void btnSubmit_Click(object sender, RoutedEventArgs e) { gRunningManual = true; oRecognizer.RecognizeAsyncCancel(); while (oRecognizer.AudioState != 0) { } RecognitionResult rr = oRecognizer.EmulateRecognize(txtInput.Text); txtInput.Text = ""; gRunningManual = false; //oRecognizer.RecognizeAsync(RecognizeMode.Multiple); }
private void BtnListen_Click(object sender, EventArgs e) { if (!listening) { listenAlways.RecognizeAsyncCancel(); listenAlways.RecognizeAsyncStop(); listenAlways.EmulateRecognize("HELLO"); } else { engine.RecognizeAsyncCancel(); engine.RecognizeAsyncStop(); engine.EmulateRecognize("STOP LISTENING"); } }
void DetectSpeech() { while (true) { try { if (input != "") { recognizer.EmulateRecognize(input); input = ""; } recognizer.Recognize(); } catch { } Thread.Sleep(5); } }
public Listen() // ecoute l'user parler { // Create an in-process speech recognizer for the en-US locale. using ( SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine( new System.Globalization.CultureInfo("fr"))) { // crée et charge la grammaire grammar. this.vocabulaire.lireFichierXML(); // Console.WriteLine(vocabulaire.recupererVocabulaire().Enabled); recognizer.LoadGrammar(this.vocabulaire.recupererVocabulaire()); // Add un event for the speech recognized event. recognizer.EmulateRecognize("allume"); recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized); // Configure input to the speech recognizer. recognizer.SetInputToDefaultAudioDevice(); // Start asynchronous, continuous speech recognition. recognizer.RecognizeAsync(RecognizeMode.Multiple); // Keep the console window open. while (true) { Console.ReadLine(); } } }
public void StartRecognition(bool emulate) { if (emulate) { Thread.Sleep(500); rec.EmulateRecognizeAsync("include io_stream"); Thread.Sleep(500); rec.EmulateRecognizeAsync("using_namespace standard"); Thread.Sleep(500); rec.EmulateRecognizeAsync("function void main"); Thread.Sleep(500); rec.EmulateRecognizeAsync("print_line string This string is going to be printed"); Thread.Sleep(800); rec.EmulateRecognize("add "); } else { //Start recognizer rec.RecognizeAsync(RecognizeMode.Multiple); recognizing = true; } }
public void FeedInput(string input) { _recognizer.EmulateRecognize(input); }
private void btnStop_Click(object sender, EventArgs e) { recEngine.EmulateRecognize("Stop Listening"); }
private void button1_Click(object sender, EventArgs e) { alwaysOnListener.EmulateRecognize("Hey Larry start listening to me"); }