Delen via


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Support for Semantic Markup (Microsoft.Speech)

The Microsoft Speech Platform SDK 11 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.

semantics/1.0-literals

This value declares that the content within tag elements is string literals as defined in the SISR specification. A string literal may be a boolean, an integer, a float, or a string. A string CANNOT 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 (Microsoft.Speech) 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 (Microsoft.Speech)

Semantic Results Content (Microsoft.Speech)

Referencing Grammar Rule Variables (Microsoft.Speech)

Grammar Rule Name Referencing (Microsoft.Speech)

Grammar Rule Reference Referencing (Microsoft.Speech)

Complete Example Grammars with SI Markup (Microsoft.Speech)