Semantic Results Content (Microsoft.Speech)
This topic describes how the semantic interpreter generates semantic results.
Every rule element in a grammar has a single Rule Variable that holds a semantic value that can be composed of multiple properties. This Rule Variable can be assigned a value, and can be evaluated.
The semantic values associated with a Rule Variable consist of the recognized text (the text variable) and the recognition confidence score (the score variable). These values are generated when the recognizer matches the user's speech to the words or phrases that are defined by the rule. The semantic value corresponding to the highest level rule in the grammar (the root rule) is serialized and returned in the Semantic Markup Language (SML) output. Because a valid grammar contains no more than one root rule element, the semantic values returned in the SML output consist of the recognized text and recognition confidence score for the complete set of words and phrases in an utterance that match a path through the whole grammar. Semantic results will not be generated for rules in valid grammars that do not contain a root rule, unless the rules are explicitly referenced from a within a grammar that does contain a root rule.
Application developers can use script expressions contained in tag elements to generate semantic values for items that are contained in the rule and associate these item-specific values with the Rule Variable as properties of the Rule Variable. See Grammar Rule Name Referencing (Microsoft.Speech). Developers can also assign the semantic value of subrules (referenced rules) in the grammar to the Rule Variable of the higher level containing rule. See Grammar Rule Reference Referencing (Microsoft.Speech). The values generated by script expressions are not explicitly typed and can be of any type defined in ECMA-327. For more information, see Using the tag Element (Microsoft.Speech).
When an author adds semantic interpretation markup to the grammar, in addition to the score and the recognized text attributes for the root rule, only values generated by script expressions contained in tag elements appear in the SML output. For more information and examples, see SML Output Overview (Microsoft.Speech).