Click here to Skip to main content
15,895,667 members

Comments by jmallory0001 (Top 5 by date)

jmallory0001 6-Jul-17 14:57pm View    
Thank you so much! I figured it would be something relatively simple.
jmallory0001 12-May-15 20:53pm View    
I figured it out. It was the xml file. You can not have more than one command rule per grammar. The grammar I was testing came straight from microsoft but did not function as described. I did get speechrecognized to fire if I said "play the song pause the song stop the song". If you break up each command into it's own grammar and load them all then it works as intended.
jmallory0001 12-May-15 14:55pm View    
Yes. My code is below:
RecognitionEngine = new SpeechRecognitionEngine();
RecognitionEngine.SetInputToDefaultAudioDevice();
RecognitionEngine.SpeechRecognized += SpeechRecognized;
RecognitionEngine.SpeechDetected += SpeechDetected;
RecognitionEngine.SpeechHypothesized += SpeechHypothesized;

SrgsDocument srgsdoc = new SrgsDocument("..\\Grammars\\RootGrammar.xml");
Grammar grammar = new Grammar(srgsdoc);
RecognitionEngine.LoadGrammar(grammar);

RecognitionEngine.RecognizeAsync(RecognizeMode.Multiple);
jmallory0001 12-May-15 14:48pm View    
Thank you very much for your help. It seems to be loading now but I'm still not getting the SpeechRecognized event. It hits the Hypothesized event but no further. Do you have any guidance to resolve this?
jmallory0001 12-May-15 14:02pm View    
I have looked through the link you gave but don't see a complete example. Is the following compliant with the SRGS:

<grammar xml:lang="en-US" xmlns="http://www.w3.org/2001/06/grammar" root="topLevel" version="1.0">
<rule id="topLevel">
<ruleref uri="#playCommands"></ruleref>
</rule>
<rule id="playCommands">
<ruleref uri="#playAction"></ruleref>
<item> the </item>
<ruleref uri="#fileWords"></ruleref>
</rule>
<rule id="playAction">
<one-of>
<item> play </item>
<item> start </item>
<item> begin </item>
</one-of>
</rule>
<rule id="fileWords">
<one-of>
<item> song </item>
<item> tune </item>
<item> track </item>
<item> item </item>
</one-of>
</rule>
</grammar>