Question

I have been able to get the speech recognition working on the kinect. However I am trying to improve the efficiency of the recognition of certain words even if they are part of a sentence.

this.speechEngine = new SpeechRecognitionEngine(ri.Id);

var words = new Choices();
words.Add(new SemanticResultValue("emerging", "EMERGING"));
words.Add(new SemanticResultValue("expiriences", "EXPIRIENCES"));
words.Add(new SemanticResultValue("paris", "PARIS"));
words.Add(new SemanticResultValue("atlanta", "ATLANTA"));
words.Add(new SemanticResultValue("creative", "CREATIVE"));
words.Add(new SemanticResultValue("back", "BACK"));

var gb = new GrammarBuilder { Culture = ri.Culture };
gb.AppendWildcard();
gb.Append(words);

var g = new Grammar(gb);
speechEngine.LoadGrammar(g);

speechEngine.SpeechRecognized += SpeechRecognized;

speechEngine.SetInputToAudioStream(
  this.audioStream, new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null));
  speechEngine.RecognizeAsync(RecognizeMode.Multiple);
Was it helpful?

Solution

You should take a step back and review the Micrsoft Speech Platform (version 11 is the most current).

http://msdn.microsoft.com/en-us/library/dd266409.aspx

The documentation, including those referenced, goes into detail about how specific you can be when dealing with the grammar definitions. One of the better document goes into the Speech Recognition Grammar Specification (SRGS) v1.0 and how you can define "dynamic" vocabulary.

http://www.w3.org/TR/speech-grammar/

If you are wanting more dynamic vocabulary I highly recommend you use an external XML (defined using SRGS) versus defining your grammar in code.

For example, here is a section I created for airlines:

  <rule id="showFlight">
    <example>Show me Alaska Airlines flight number 2117.</example>
    <example>Where is US Airways flight 45.</example>
    <item>
      <one-of>
        <item>show me</item>
        <item>where is</item>
      </one-of>
    </item>
    <item>
      <ruleref uri="#airline" />
      <tag>out.Carrier = rules.airline;</tag>
    </item>
    flight
    <item repeat="0-1">number</item>
    <tag>out.Number = "";</tag>
    <item repeat="1-">
      <ruleref uri="#digit" />
      <tag>out.Number += rules.digit;</tag>
    </item>
  </rule>

... notice that there is a lot of references and a lot of optional and alternatives in there... and this one is simple!

You are going to have less luck simply picking up the word "Paris" in the middle of a sentence, then to you will doing research into how your application will be used and spoken to when referencing the word "Paris".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top