- Contents
Interaction Speech Recognition Technical Reference
Grammar Syntax
Speech Recognition Grammar Specification (SRGS) consists of two syntaxes for defining grammars:
-
Augmented Backus-Naur Form (ABNF).
-
Grammar Extensible Markup Language (GrXML)
Interaction Speech Recognition supports both syntaxes in grammar files.
SRGS uses Semantic Interpretation for Speech Recognition (SISR) v1.0 for semantic interpretation.
Example ABNF grammar file
The ABNF syntax uses symbols, words, and operators; much like a scripting or programming language.
// Header #ABNF 1.0; language en-US; mode voice; // Root rule root $yesorno; // Rules $yes = yes | correct | yeah | affirmative; $no = no | nope | negative; $yesorno = $yes | $no;
To ensure that you can easily identify ABNF grammars when browsing a file system, use the .gram file name extension.
Example GrXML grammar file
The GrXML syntax uses elements and pairs of elements defined within
angle bracket characters (< >
).
<!--Header--> <?xml version="1.0"?> <grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en-US" root="yesorno" mode="voice"> <!--Rules--> <rule id="yesorno"> <one-of> <item><ruleref uri="#yes" /></item> <item><ruleref uri="#no" /></item> </one-of> </rule> <rule id="yes"> <one-of> <item>yes</item> <item>correct</item> <item>yeah</item> <item>affirmative</item> </one-of> </rule> <rule id="no"> <one-of> <item>no</item> <item>nope</item> <item>negative</item> </one-of> </rule> </grammar>
To ensure that you can easily identify GrXML grammars when browsing a file system, use the .grxml file name extension.
For more information about the SRGS specification and how to create grammars, see http://www.w3.org/TR/speech-grammar/.