2
I have an example of using the Microsoft Speech Api, but all examples of Speech Recognition use Grammar for recognition only of what was pre-defined, I wonder if I always have to use Grammars or if there is some way to recognize plain text?
Below the example with Grammar:
SpeechRecognitionEngine sre = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("pt-BR"));
sre.SetInputToDefaultAudioDevice();//Som capturado pelo microfone
var estabelecimentos = new Choices("hotel", "restaurante", "cinema", "shopping");
var locais = new Choices("Rio Grande", "São José do Norte", "Pelotas");
GrammarBuilder gb = new GrammarBuilder();
gb.Culture = new System.Globalization.CultureInfo("pt-BR");
gb.Append("Buscar");
gb.Append(estabelecimentos);
gb.Append(new Choices("em", "no"));
gb.Append(locais);
gb.Append(new Choices("e", "ou"), 0, 1);
gb.Append(locais, 0, 1);
var g = new Grammar(gb);
sre.LoadGrammarAsync(g);
sre.EndSilenceTimeout = new TimeSpan(1000);
sre.SpeechRecognitionRejected += Sre_SpeechRecognitionRejected;
sre.SpeechRecognized += Sre_SpeechRecognized; ;
sre.SpeechDetected += Sre_SpeechDetected;
Console.WriteLine("Ouvindo");
sre.Recognize();