Share via


Support for Semantic Markup

System.Speech supports two models and syntax for creating semantic content in XML-format grammars that conform to the Speech Recognition Grammar Specification (SRGS) Version 1.0:

The scripting language supported by both models is ECMA-327, which is implemented in the Microsoft speech recognition engines using the Microsoft JScript interpreter.

To specify the syntax of semantic content in an SRGS XML grammar, use the tag-format attribute.

Specify the Format for Semantic Interpretation Markup

The tag-format attribute of the grammar element identifies the type of semantic interpretation markup in a grammar. For grammars used with Microsoft speech recognition engines, this value can be one of the following:

tag-format value

Description

semantics/1.0

This value declares that the content within tag elements is ECMAScript as defined in the SISR specification.

semantics-ms/1.0

This value declares that the content within tag elements is ECMAScript as implemented by Microsoft.

properties-ms/1.0

This value declares that the content within tag elements is a boolean, an integer, or a string. A string must be enclosed in double quotes.

Syntactical Differences

The SISR model and the Microsoft model for semantic content use different syntax to refer to Rule Variables.

When using tag-format="semantics/1.0" (conforms to the SISR specification):

  • The Rule Variable of the containing rule element is identified by "out".

  • The name of the object that has access to the Rule Variable of rule elements outside the containing rule element is identified by "rules".

  • The result from the latest referenced rule that matches the utterance can be represented by "rules.latest()".

When using tag-format="semantics-ms/1.0" (syntax defined by Microsoft):

  • The Rule Variable of the containing rule element is identified by "$".

  • The Rule Variable of a rule element that is outside of the containing rule element is identified by "$rulename", where "rulename" is the name of the referenced rule.

  • The result from the latest referenced rule that matches the utterance can be represented by the shorthand symbol "$$".

See tag Element for examples that use each of the values for tag-format and demonstrate the supported syntaxes.

Note

Microsoft speech recognition engines do not support Augmented Backus-Naur Form (ABNF) grammars. Use only XML-format grammars.

See Also

Concepts

Semantic Interpretation Markup

Semantic Results Content

Using the tag Element

Referencing Grammar Rule Variables

Grammar Rule Name Referencing

Grammar Rule Reference Referencing

Complete Example Grammars with SI Markup