YSKRecognizerDelegate protocol

#import <YSKRecognizerDelegate.h>

The protocol defines the callbacks of the delegate that is called by an object 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:didReceivePartialResults:withEndOfUtterance:

Called when a partial result is received.

-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.

-recognizerDidFinishRecording:

Called when the recognizer finished recording sound.

-recognizerDidStartRecording:

Called when the recognizer began recording sound.

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:didReceivePartialResults:withEndOfUtterance:

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

Called when a partial result is received.

This method is called when a partial recognition result is received. It can be called any number of times after recognition has started and before it finishes. In addition to the result itself, this method is passed a flag that is set to YES when the end of the "utterance" is detected. Speech is divided into utterances based on the length of pauses between words.
Note.

This algorithm may be changed in future version.

Parameters:
results

Partial recognition result.

endOfUtterance

YES, if the end of an 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).

Note.

The function is called even if the power has not changed.

-recognizerDidDetectSpeech:

- (void) recognizerDidDetectSpeech:(YSKRecognizer *) recognizer

Called when speech is detected.

Note.

This method is only called if the Voice Activity Detector (VAD) is enabled.

-recognizerDidFinishRecording:

- (void) recognizerDidFinishRecording:(YSKRecognizer *) recognizer

Called when the recognizer finished recording sound.

-recognizerDidStartRecording:

- (void) recognizerDidStartRecording:(YSKRecognizer *) recognizer

Called when the recognizer began recording sound.