Semantic Items
The application needs to gather semantic information from the user's responses, and to retain that semantic information for use throughout the application. In applications developed with the Speech Application SDK (SASDK), each rule in the grammar specifies semantic information in Semantic Markup Language (SML) returned by the Speech Recognition (SR) engine after it analyzes the user's responses.
In the SASDK, the SemanticMap control is the repository for this information. It consists of a collection of SemanticItem controls, which contain information about semantic state, binding and postback properties. To get the semantic information, it is necessary to:
- Specify what each rule in the grammar returns.
- Add a SemanticItem for semantic information returned by each rule.
- Specify in each control how to associate the semantic information returned by the grammar with a SemanticItem.
SemanticItem controls have a property called state, which can be set to Empty, NeedsConfirmation, or Confirmed.
Confidence Thresholds
In the SASDK, property builders afford control of the various confidence thresholds that govern how semantic items deal with accepting user input. The following illustration shows a semantic item for which both Reject and ConfirmThreshold values are set.
Assuming the user says something that is in grammar, the recognizer will return one or more SML elements specified in the grammar. Confidence scores from the recognizer are embedded in the returned SML fragment. These scores are values ranging from zero to one, representing the recognizer's confidence in the results.
The following example demonstrates a fragment of SML, returned by the SR engine, representing the spoken phrase "January twenty second."
<SML confidence="0.568" text="January twenty second" utteranceConfidence="0.568">
<CalendarQuery confidence="0.568">
<date confidence="0.568" name="PreciseDate">
<Year text="" name="Assumed" confidence="0.568">2004</Year>
<Month confidence="0.123" name="Common">1</Month>
<Day confidence="0.790" name="Common">22</Day>
</date>
</CalendarQuery>
</SML>
The SML might contain individual confidence scores for each element in the SML output. The semantic item will reject any SML result below the specified threshold and its state property will be set to Empty, while a misrecognition exception is triggered.
Confirmation Threshold
Designers can specify a confirmation threshold for a semantic item. The semantic item accepts data returned with scores in excess of the confirmation threshold. In this case, the semantic item's state property is set to Confirmed. Any data with scores below the confirmation threshold will be marked as needing confirmation.
By setting both confirmation and rejection thresholds the designer can open a three-tiered window for incoming semantic data. The recognizer either accepts the incoming data, marks it as needing further confirmation or simply rejects it as out of grammar.