Protocol YSKRecognizerDelegate

The protocol defines the callbacks of the delegate that tracks the recognition process.

The methods are called during the recognition lifecycle. The delegate is notified of the start of recording, a new chunk of audio data, recognition completion (either successful or with an error), and of other events.

Instance Methods

-recognizer:didFailWithError:

Called when the recognition process failed with an error.

-recognizer:didReceiveMusicResult:

Called when the music recognition result is received.

-recognizer:didReceivePartialResults:withEndOfUtterance:

Called when an intermediate recognition result is received.

-recognizer:didUpdatePower:

Called each time after recording a chunk of audio data, and is used for updating the speech power indicator in the user interface.

-recognizerDidDetectSpeech:

Called when the detection of speech starts (the user begins to speak).

-recognizerDidDetectSpeechEnd:

Called when the user finished speaking.

-recognizerDidFinishRecognition:

Called if the recognition process completed successfully.

-recognizerDidFinishRecording:

Called when audio recording stops.

-recognizerDidStartRecording:

Called when audio recording starts.

Method Detail

-recognizer:didFailWithError:

- (void)recognizer:(id< YSKRecognizing >)recognizer
  didFailWithError:(NSError *)error 

Called when the recognition process failed with an error.

Errors may occur for various reasons:
  • Error opening an audio source.

  • Server communication error.

  • Invalid parameter value passed during initialization (for example, the language code or authentication data).

  • The user aborted the request, and so on.

Possible error codes are listed in YSKErrorCode.
Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.

error

Error during speech recognition.

-recognizer:didReceiveMusicResult:

- (void)recognizer:(id< YSKRecognizing >)recognizer
didReceiveMusicResult:(YSKTrack *)track 

Called when the music recognition result is received.

This method is called if the enableMusicRecognition property is set.
Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.

track

Music recognition result.

-recognizer:didReceivePartialResults:withEndOfUtterance:

- (void)recognizer:(id< YSKRecognizing >)recognizer
didReceivePartialResults:(YSKRecognition *)results
withEndOfUtterance:(BOOL)endOfUtterance 

Called when an intermediate recognition result is received.

The method can be called multiple times after recognition begins. The method is passed a part of the recognition result and the end of utterance flag. If endOfUtterance = YES, the results parameter contains the final recognition result.
Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.

results

Partial recognition result.

endOfUtterance

End of utterance flag. Acceptable values: YES - the end of the utterance is detected; NO - the utterance is not yet complete.

-recognizer:didUpdatePower:

- (void)recognizer:(id< YSKRecognizing >)recognizer
    didUpdatePower:(float)power 

Called each time after recording a chunk of audio data, and is used for updating the speech power indicator in the user interface.

Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.

power

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

-recognizerDidDetectSpeech:

- (void)recognizerDidDetectSpeech:(id< YSKRecognizing >)recognizer 

Called when the detection of speech starts (the user begins to speak).

This method is called if the VAD is enabled. The VAD is enabled by default. Use the enableVAD property to enable or disable the VAD.
Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.

-recognizerDidDetectSpeechEnd:

- (void)recognizerDidDetectSpeechEnd:(id< YSKRecognizing >)recognizer 

Called when the user finished speaking.

This method is called if the VAD is enabled. The VAD is enabled by default. Use the enableVAD property to enable or disable the VAD.
Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.

-recognizerDidFinishRecognition:

- (void)recognizerDidFinishRecognition:(id< YSKRecognizing >)recognizer 

Called if the recognition process completed successfully.

The method is called if speech was recognized successfully. Otherwise, recognizer:didFailWithError: is called.
Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.

-recognizerDidFinishRecording:

- (void)recognizerDidFinishRecording:(id< YSKRecognizing >)recognizer 

Called when audio recording stops.

Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.

-recognizerDidStartRecording:

- (void)recognizerDidStartRecording:(id< YSKRecognizing >)recognizer 

Called when audio recording starts.

Parameters:
recognizer

Link to the class object that implements the YSKRecognizing protocol that invoked the method.