SRGS Grammar XML Reference (Microsoft.Speech)
The Microsoft Speech Platform SDK 11 supports grammar files that use Extensible Markup Language (XML) elements and attributes, as specified in the World Wide Web Consortium (W3C) Speech Recognition Grammar Specification (SRGS) Version 1.0. These XML elements and attributes represent the rule structures that define the words or phrases (commands) recognized by speech recognition engines.
This section documents the elements and attributes of the SRGS specification, as implemented by the Speech Platform SDK 11. Note that support for XML-format grammars in the Speech Platform SDK 11 differs from the SRGS specification in some areas. These differences are described in the topics of the elements to which they apply.
The following table describes the XML grammar elements from the SRGS specification, and extensions by Microsoft, listed in alphabetical order.
Specifies sample phrases that a user can say to match the containing rule. This element is illustrative and for the benefit of a developer reading the grammar; the speech recognition engine ignores it.
Specifies the highest level container for an XML grammar definition.
version, mode, root, tag-format, xml:lang, xml:base, xmlns
Contains any legal rule expansion.
repeat, repeat-prob, weight
Specifies one or more external pronunciation lexicon documents.
Specifies document metadata.
Contains information about the document in a metadata schema.
Specifies a set of alternative phrases that can possibly be matched by a user.
Specifies the definition of a sequence of phrases that, if matched by user input, must be matched in the sequence specified in the definition.
id, scope, sapi:dynamic
Specifies a reference to the rule to be imported.
uri, special, type
Specifies a phrase and a matching mode that allows the entire phrase to be recognized when only a subset of that phrase is found in the speech input.
Specifies semantic information and/or ECMA-compliant script that allows for the return of additional information when an element or series of elements is recognized.
Specifies a string that a speech recognizer can convert to a phonetic representation.
The meta, metadata and lexicon elements must occur before all rule elements contained with the root grammar element. There are no constraints on the ordering of the metadata, meta and lexicon elements.
The following table lists elements and features of XML documents that are not specific to grammar files.
XML DOCTYPE Declaration
Specifies a reference to the grammar's associated Document Type Definition (DTD).
Specifies the XML version number, and optionally the character encodings, as part of a grammar document's XML declaration on the first line of the document.
Comments in GRXML Documents
Can be used to specify the description of a rule.