My question is how can I load a grammar file that uses the tags they list in the MSDN docs? I want to use the format tags that are documented in MSDN under the heading Grammar Format Tags (SAPI 5.3).
http://msdn.microsoft.com/en-us/library/ms723634(VS.85).aspx
There it lists tags like DEFINE, LIST, OPT etc. However whenever I try to use those tags in the grammar.xml file I get an error saying that that tag is not supported.
If use a grammar file that only uses the tags one-of, item, etc. That are listed here in the MSDN; the grammar file loads.
http://msdn.microsoft.com/en-us/library/ms870140.aspx
I know it is probably something simple but I cant seem to figure it out...
Grammar file...that works
<grammar xmlns="http://www.w3.org/2001/06/grammar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar
http://www.w3.org/TR/speech-grammar/grammar.xsd"
xml:lang="en-US" version="1.0" root="command">
<rule id="command" scope="public">
<one-of>
<item>nail</item>
<item>hammer</item>
<item>saw</item>
</one-of>
</rule>
</grammar>
Code listing-------------------
public Form1()
{
InitializeComponent();
// set up the recognizer
_speechRecognizer = new SpeechRecognizer();
_speechRecognizer.Enabled = false;
_speechRecognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(_speechRecognizer_SpeechRecognized);
// set up the command and control grammar
Grammar commandGrammar = new Grammar(@"grammar.xml");
commandGrammar.Name = "main command grammar";
commandGrammar.Enabled = true;
// activate the command grammer
_speechRecognizer.LoadGrammar(commandGrammar);
_speechRecognizer.Enabled = true;
}