YSKRecognizerDelegate protocol

#import <YSKRecognizerDelegate.h>

The protocol defines the callbacks of the delegate that is called by an instance of the YSKRecognizer class.

These methods are called during the recognition lifecycle. The delegate is notified when recording has started, a new portion of audio data has been recorded, the recognition process has finished (successfully or with an error), and other events occur.

Instance methods

-recognizer:didCompleteWithResults:

Called when the recognition process completes successfully.

-recognizer:didFailWithError:

Called if the recognition process failed with an error.

-recognizer:didReceiveMusicResponse:

Called when the result is received after recognizing a fragment of music.

-recognizer:didReceivePartialResults:withEndOfUtterance:

Called when the received result is not final.

-recognizer:didRecordSoundData:

Called when a chunk of audio data has been recorded.

-recognizer:didUpdatePower:

Called for updating the power of the speech signal.

-recognizerDidDetectSpeech:

Called when speech is detected.

-recognizerDidDetectSpeechEnd:

Called when the user finished speaking.

-recognizerDidFinishRecording:

Called when YSKRecognizer has finished recording audio.

-recognizerDidStartRecording:

Called when YSKRecognizer has started recording audio.

Method descriptions

-recognizer:didCompleteWithResults:

- (void) recognizer:(YSKRecognizer *) recognizer
didCompleteWithResults:(YSKRecognition *) results

Called when the recognition process completes successfully.

This is the mechanism used by the recognizer to provide recognition results. The method is called only if speech was recognized successfully. Otherwise, recognizer:didFailWithError: is called.
Parameters:
results

Recognition result

-recognizer:didFailWithError:

- (void) recognizer:(YSKRecognizer *) recognizer
didFailWithError:(NSError *) error

Called if the recognition process failed with an error.

Errors can occur for a number of reasons: an error opening the audio device, an error communicating with the server, an invalid parameter value passed during initialization (for example, the language code or authentication data), the user canceling the request, and so on.
Note.

This method is called only if speech recognition failed with an error. Otherwise, recognizer:didCompleteWithResults: is called.

Parameters:
error

Error during speech recognition.

-recognizer:didReceiveMusicResponse:

- (void) recognizer:(YSKRecognizer *) recognizer
didReceiveMusicResponse:(NSString *) result

Called when the result is received after recognizing a fragment of music.

This method is only used for recognizing queries related to music.

-recognizer:didReceivePartialResults:withEndOfUtterance:

- (void) recognizer:(YSKRecognizer *) recognizer
didReceivePartialResults:(YSKRecognition *) results
withEndOfUtterance:(BOOL) endOfUtterance

Called when the received result is not final.

This method is called when an intermediate recognition result is received. The method can be called multiple times after recognition begins. The method is passed part of the recognition result and a flag that is set to YES when the end of an utterance is detected.
Note.

Speech is divided into utterances based on the length of pauses between words. This algorithm may be changed in future version.

Parameters:
results

Partial recognition result.

endOfUtterance

The parameter value is set to YES if the end of the utterance was detected.

-recognizer:didRecordSoundData:

- (void) recognizer:(YSKRecognizer *) recognizer
didRecordSoundData:(NSData *) data

Called when a chunk of audio data has been recorded.

Parameters:
data

Raw audio data recorded from the audio device.

Note.

The sample width and rate are unspecified and may change.

-recognizer:didUpdatePower:

- (void) recognizer:(YSKRecognizer *) recognizer
didUpdatePower:(float) power

Called for updating the power of the speech signal.

This method is called each time after recording a chunk of audio data, and is used for updating the speech power indicator in the user interface.
Parameters:
power

A fractional number between 0 and 1 indicating the power of the signal (0 means no signal, and 1 is the maximum signal).

-recognizerDidDetectSpeech:

- (void) recognizerDidDetectSpeech:(YSKRecognizer *) recognizer

Called when speech is detected.

Note.

This method is only called if the Voice Activity Detector (VAD) is enabled. The detector is disabled by default. Use the Recognizer.setVADEnabled method for enabling and disabling the VAD. The Recognizer.getVADEnabled method returns the state of the VAD.

-recognizerDidDetectSpeechEnd:

- (void) recognizerDidDetectSpeechEnd:(YSKRecognizer *) recognizer

Called when the user finished speaking.

Note.

This method is only called if the Voice Activity Detector (VAD) is enabled. The detector is disabled by default. Use the Recognizer.setVADEnabled method for enabling and disabling the VAD. The Recognizer.getVADEnabled method returns the state of the VAD.

-recognizerDidFinishRecording:

- (void) recognizerDidFinishRecording:(YSKRecognizer *) recognizer

Called when YSKRecognizer has finished recording audio.

-recognizerDidStartRecording:

- (void) recognizerDidStartRecording:(YSKRecognizer *) recognizer

Called when YSKRecognizer has started recording audio.