Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Speech Recognition Manager /
Chapter 1 - Speech Recognition Manager / Using the Speech Recognition Manager


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's kSRLMObjType 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's kSRRefCon 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;
}

Previous Book Contents Book Index Next

© Apple Computer, Inc.
22 JAN 1997