Voice recognition without Grammar

Asked

Viewed 574 times

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();

1 answer

0


I searched several places, I read the documentation of Microsoft Speech Platform, and unfortunately I could not recognize plain text, in the documentation but there is a method in the GrammarBuilder, AppendDictation(), that it should work for what I wanted, but I found issues in MSDN that also said it didn’t work and that the API is more suitable for commands and not long texts.

The code with Appenddictation();

gb.AppendDictation();

Link to the official documentation

Browser other questions tagged

You are not signed in. Login or sign up in order to post.