Share via


Grammar XML

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The syntax of the XML Grammar Tag Format in Speech Server uses Extensible Markup Language (XML) elements and attributes, as specified in the World Wide Web Consortium (W3C) Speech Recognition Grammar Specification Version 1.0. These XML elements and attributes represent the rule structures that define the words or phrases (commands) recognized by speech recognition engines.

Recognition Grammar Elements

The following table defines the XML elements that comprise the XML Grammar Tag Format, listed in alphabetical order.

Element Description Required/ Optional Attribute

example

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.

Optional

???

grammar

Specifies the highest level container for an XML grammar definition.

Required

version, mode, root, tag-format, xml:lang, xml:base, xmlns

item

Contains any legal rule expansion.

Optional

repeat, repeat-prob, weight

lexicon

Specifies one or more external pronunciation lexicon documents.

Optional

uri, type

meta

Specifies document metadata.

Optional

name, content

one-of

Specifies a set of alternative phrases that can possibly be matched by a user.

Optional

xml:lang

rule

Specifies the definition of a sequence of phrases that, if matched by user input, must be matched in the sequence specified in the definition.

Required

id, scope

ruleref

Specifies a reference to the rule to be imported.

Optional

uri, special, type, xml:lang

tag

Specifies semantic information and/or an ECMA-compliant script that allows for the return of additional information when an element or series of elements is recognized.

Optional

???

token

Specifies a string that a speech recognizer can convert to a phonetic representation.

Optional

???

Element Attributes

The following defines the XML attributes that comprise the XML Grammar Tag Format, listed in alphabetical order.

  • content
    Specifies the property name of metadata defined by a meta element.
  • id
    Specifies the programmatic name of a rule.
  • mode
    Specifies the mode (voice or DTMF) of the contained or referenced grammar.
  • name
    Specifies the value of the metadata property identified by the name attribute of a meta element.
  • repeat
    Specifies the number of times a set of phrases within a rule can be repeated.
  • repeat-prob
    Specifies the probability of successive repetition of a repeated item.
  • root
    Specifies a single rule within a grammar document that can be activated for recognition.
  • scope
    Specifies whether a rule can be used only within its containing grammar or referenced by another grammar.
  • special
    Specifies a reference to one of the three reserved rule names that have specific interpretation and processing by a speech recognizer.
  • tag-format
    Specifies the content type of all tag elements that a grammar contains.
  • type
    Specifies the media type as defined in RFC2045 and RFC2046.
  • uri
    Specifies a location by Uniform Resource Identifier (URI).
  • version
    Specifies which version of the XML grammar specification is used.
  • weight
    Specifies a multiplying factor that increases the likelihood that an alternative is chosen from an alternative expansion.
  • xml:base
    Specifies a grammar document's base URI.
  • xml:lang
    Specifies the language identifier, and optionally a country/region or other variation, for the content of the element on which it appears.
  • xmlns
    Specifies the grammar namespace used.

Additional File Format Information

The following table contains links to additional XML Grammar Tag Format information.

Topic Description

Rule Expansion

Specifies the sets of words or phrases within a rule that is used to match user input.

XML DOCTYPE Declaration

Specifies a reference to the grammar's associated Document Type Definition (DTD).

XML Header

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 for display in the Speech Server Speech Grammar Editor Rule Browser.