Share via


SML Output Overview

  Microsoft Speech Technologies Homepage

Upon recognition, the semantic interpretation mechanism of the Microsoft Speech Application SDK Version 1.1 (SASDK) returns a semantic result to the speech-enabled Web application. The semantic result of a recognition is the value of the root Rule Variable (RRV) of the grammar that performs the recognition.

A semantic result typically contains information that is more useful to the application than only the text of the utterance. For example, a grammar for specifying an airport may recognize the utterance, "Heathrow Airport," and generate the airport code "LHR" as the semantic result. Scripts that are contained within tag elements inserted in the input grammar generate the content of a semantic result. The Microsoft Speech recognizer serializes the script products and generates the semantic result in the form of a Semantic Markup Language (SML) output.

SML is a container format for holding the semantic information that semantic interpretation markup in the input grammar generates. SML output is a valid XML document in which the top-level element is named "SML." The SML element can have zero, one, or more child elements, depending on whether the input grammar contains markup for semantic interpretation.

SML Element Content and Structure

The following list outlines the attribute-value pairs that the semantic interpreter automatically includes in the start tag of the SML element.

  • utteranceConfidence—a floating point value between 0.000–1.000.
  • text—a string consisting of all recognized utterance tokens
  • confidence—a floating point value between 0.000–1.000.

The recognizer automatically sets the values of the utteranceConfidence and text attributes. These values identify the confidence score for the full utterance, and the recognized text of the utterance. These values cannot be changed by the developer. The recognizer sets the value of utteranceConfidence to 1.000 for results derived from text parsing, or if the recognition engine is unable to generate a confidence score for the full utterance.

The recognizer sets the value of the confidence attribute to the value of the utteranceConfidence attribute by default. Using scripts in semantic interpretation markup, developers are able to change the value of this attribute. Developers may want to control the value of this attribute in order to push a score from a semantically relevant node upwards, or to calculate an interpretive score for the semantic result based on criteria other than simple utterance confidence.

Developers can specify the text content of the SML element by assigning to the _value property of the RRV. Developers can also add attributes to the SML element's start tag by creating child properties of the RRV's _attributes property.

The following code block illustrates the general structure of the SML output for the top-level SML element. Strings enclosed in square brackets ("[]") describe the values or names that appear where the bracketed strings are located.

<SML utteranceConfidence="[full_utterance_confidence_score]" 
     text="[utterance_tokens]" 
     confidence="[value_of_RRV_confidence_property]" 
     [$._attributes.attributeName]="[value]">
   [value_of_RRV]
</SML>

The recognizer serializes input grammars that contain no semantic interpretation markup into SML output that contains only the top-level SML element and its contents. For examples, see Serialization of the Root Rule Variable (RRV) and SML Results Using Semantic Interpretation Tags.

Child Element Content and Structure

Using semantic interpretation tags, developers can obtain confidence scores and text content at the rule level. If a developer assigns variables for semantic interpretation to words or phrases in the input grammar, the SML output will contain child elements corresponding to each word or phrase associated with the semantic interpretation markup. The inclusion of any semantic interpretation markup in the grammar disables the default behavior of the semantic interpreter. The SML output contains only the elements that are marked for semantic interpretation.

Child elements take the name of the property that produces them. The semantic interpreter automatically includes a confidence attribute in the start tag of child elements. Additional attribute-value pairs can be added to the start tag of child elements using the _attributes property. Use the _value property to set the text content of the child element. The value of a child element can also be an array, in which case each item in the array is enclosed in an item element that is contained by the child element. Refer to Serialization of Developer-defined Rule Variable Properties for examples.

The following code block illustrates the general structure of an SML output that illustrates the structure of two different child elements. Strings enclosed in square brackets ("[]") describe the values or names that appear where the bracketed strings are located.

<SML utteranceConfidence="[full_utterance_confidence_score]" 
     text="[utterance_tokens]" 
     confidence="[value_of_RRV_confidence_property]" 
     [$._attributes.attributeName]="[value]">
   [$._value]
   
     <[$.childPropertyName1] [$.childPropertyName1._attributes.attributeName]="[value]">
       [$.childPropertyName1._value]
     </[$.childPropertyName1]>

     <[$.childPropertyName2] [$.childPropertyName2._attributes.attributeName]="[value]">
       <item>[arrayElement[0]]</item>
       <item>[arrayElement[1]]</item>
     </[$.childPropertyName2]>
   
</SML>