C# Speech Recognizing Multiple Words together? (Recognize a sentence)

前端 未结 2 2028
天涯浪人
天涯浪人 2020-12-18 14:15

I\'m building an application that recognizes multiple words from a user; thus putting together a sentence using the words recognized.

Here\'s what I have as of now:<

2条回答
  •  無奈伤痛
    2020-12-18 15:04

    It recognizes one word because you incorrectly constructed the grammar. Since you constructed the grammar consisting of choice of one of the words "what", "is", "a", "car" it exactly recognizes one of the words.

    You probably want to read introduction into grammars and related documentation.

    http://msdn.microsoft.com/en-us/library/hh378438(v=office.14).aspx

    If you want to construct the grammar describing the phrase you can just use GrammarBuilder like this:

      Grammar gr = new Grammar(new GrammarBuilder("what is a car"));
    

    This grammar will recognize a phrase.

    To understand how Choices work you can read documentation on Choices:

    http://msdn.microsoft.com/en-us/library/microsoft.speech.recognition.choices(v=office.14).aspx

提交回复
热议问题