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.
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.
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.
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.
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.
The following topics describe the implementation of semantic interpretation in Microsoft speech recognition engines.
Describes two models and syntax for authoring semantic scripts in XML-format SRGS grammars.
Describes how the semantic interpreter generates semantic results.
Describes and illustrates the use of the tag element for semantic interpretation scripts and includes examples that show the semantic output that the contents of tag elements generate.
Describes and illustrates the two different types of Rule Variable referencing.
Describes how to reference the Rule Variable of the containing rule element and how to create child and grandchild properties of the Rule Variable.
Describes how to reference the Rule Variable of rule elements outside of the containing rule.
Presents two example grammars that contain scripts for semantic interpretation.
Presents a grammar of moderate complexity that contains several rules and uses semantic scripts extensively.