Partilhar via


Note

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

Semantic Interpretation Markup (Microsoft.Speech)

This section introduces semantic interpretation and describes how to use semantic interpretation markup in grammars that conform to the Speech Recognition Grammar Specification (SRGS) Version 1.0 to customize the semantic values that the speech recognizer returns as the result of a successful recognition.

What Is Semantic Interpretation?

Semantic interpretation is the process by which a semantic interpreter generates a semantic result based on an utterance that matches a path through a grammar. Scripts that are contained within tag elements and inserted in the input grammar generate the content of a semantic result. The speech recognizer serializes the products of the scripts and generates the semantic result in the form of a Semantic Markup Language (SML) output. For more information, see SML Output Overview (Microsoft.Speech).

The model and syntax of semantic interpretation that is implemented in the Microsoft recognition engines is based on Semantic Interpretation for Speech Recognition (SISR) Version 1.0.

Why Use Semantics

Using semantics effectively separates the words of spoken input from the business logic of your application. When spoken input matches a rule in your application's grammar, your application does not need to parse the recognized text to determine how to respond, if the rule contains semantics. The semantics of a grammar rule translate all the speech input options that a grammar rule defines into a result that your application expects. For example, a grammar rule for specifying an airport may recognize any of the utterances "Seattle-Tacoma", "Sea-Tac", or "Seattle", and generate the airport code "SEA" as the semantic result. Using semantics allows users of your application the flexibility to provide a variety of spoken inputs and provides your application with an actionable result. See Using Tag Elements with RuleRef Elements for an example.

Semantic Interpretation Principles

The basic principles for the semantic interpretation mechanism in the Microsoft speech recognition engines are:

  • Scripts that associate values with grammar rules generate semantic information.

  • Script expressions contained in the semantic interpretation tag element follow the syntax of ECMA-327. Not all features are supported. For exceptions, see Semantic Results Content (Microsoft.Speech).

  • The parse order of the rules in the grammar determines the order in which expressions are evaluated.

  • The semantic result (in the form of an SML output) consists of the semantic information associated with the root rule.

Semantic Interpretation Markup Reference

The following topics describe the implementation of semantic interpretation in Microsoft speech recognition engines.