Important: The information in this document is obsolete and should not be used for new development.
Setting the Rejection Word
Sometimes the recognizer can determine that the user has spoken but cannot identify the spoken utterance as matching any phrase in the active language model. In this case, the recognizer may indicate it has rejected the utterance by returning a special language model object in the recognition result'skSRLMObjType
property.By default, the returned object is a word (of type
SRWord
) whose spelling is "???". Listing 1-8 shows how your application can set the rejection word'skSRRefCon
value to a unique value. Your application can use this value when processing recognition results (as in Listing 1-17 on page 1-32) to determine that an utterance has been rejected.Listing 1-8 Setting the rejection word's reference constant value
const long kRejectedWordRefCon = 'rejc'; OSErr MySetRejectedWordRefCon (SRRecognitionSystem mySystem) { OSErr myErr = noErr; SRWord myRejectedWord = 0; Size myLen = sizeof(myRejectedWord); /* Get a reference to the rejected word. */ myErr = SRGetProperty(mySystem, kSRRejectedWord, &myRejectedWord, &myLen); /* Set the refcon of the rejected word, so we can */ /* use it later when processing the search result */ if (!myErr) myErr = SRSetProperty (myRejectedWord, kSRRefCon, &kRejectedWordRefCon, sizeof (kRejectedWordRefCon)); if (myRejectedWord) SRReleaseObject (myRejectedWord);/* balance SRGetProperty */ return myErr; }