pub unsafe trait SFSpeechRecognitionTaskDelegate: NSObjectProtocol {
// Provided methods
unsafe fn speechRecognitionDidDetectSpeech(
&self,
task: &SFSpeechRecognitionTask,
)
where Self: Sized + Message { ... }
unsafe fn speechRecognitionTask_didHypothesizeTranscription(
&self,
task: &SFSpeechRecognitionTask,
transcription: &SFTranscription,
)
where Self: Sized + Message { ... }
unsafe fn speechRecognitionTask_didFinishRecognition(
&self,
task: &SFSpeechRecognitionTask,
recognition_result: &SFSpeechRecognitionResult,
)
where Self: Sized + Message { ... }
unsafe fn speechRecognitionTaskFinishedReadingAudio(
&self,
task: &SFSpeechRecognitionTask,
)
where Self: Sized + Message { ... }
unsafe fn speechRecognitionTaskWasCancelled(
&self,
task: &SFSpeechRecognitionTask,
)
where Self: Sized + Message { ... }
unsafe fn speechRecognitionTask_didFinishSuccessfully(
&self,
task: &SFSpeechRecognitionTask,
successfully: bool,
)
where Self: Sized + Message { ... }
unsafe fn speechRecognitionTask_didProcessAudioDuration(
&self,
task: &SFSpeechRecognitionTask,
duration: NSTimeInterval,
)
where Self: Sized + Message { ... }
}SFSpeechRecognitionTask only.Expand description
A protocol with methods for managing multi-utterance speech recognition requests.
The methods of this protocol give you fine-grained control over the speech recognition process. Specifically, you use this protocol when you want to know the following:
- When the first utterances of speech occur in the audio.
- When the speech recognizer stops accepting audio.
- When the speech recognition process finishes or is canceled.
- When the speech recognizer generates a potential transcription.
Adopt the methods of this protocol in an object and pass that object in to the delegate parameter of SFSpeechRecognizer/recognitionTask(with:delegate:) when starting your speech recognition task.
See also Apple’s documentation
Provided Methods§
Sourceunsafe fn speechRecognitionDidDetectSpeech(
&self,
task: &SFSpeechRecognitionTask,
)
unsafe fn speechRecognitionDidDetectSpeech( &self, task: &SFSpeechRecognitionTask, )
Tells the delegate when the task first detects speech in the source audio.
- Parameters:
- task: The speech recognition task (an
SFSpeechRecognitionTaskobject) that represents the request.
Sourceunsafe fn speechRecognitionTask_didHypothesizeTranscription(
&self,
task: &SFSpeechRecognitionTask,
transcription: &SFTranscription,
)
Available on crate feature SFTranscription only.
unsafe fn speechRecognitionTask_didHypothesizeTranscription( &self, task: &SFSpeechRecognitionTask, transcription: &SFTranscription, )
SFTranscription only.Tells the delegate that a hypothesized transcription is available.
This method is called for all recognitions, including partial recognitions.
- Parameters:
- task: The speech recognition task (an
SFSpeechRecognitionTaskobject) that represents the request. - transcription: The hypothesized transcription in an
SFTranscriptionobject.
Sourceunsafe fn speechRecognitionTask_didFinishRecognition(
&self,
task: &SFSpeechRecognitionTask,
recognition_result: &SFSpeechRecognitionResult,
)
Available on crate feature SFSpeechRecognitionResult only.
unsafe fn speechRecognitionTask_didFinishRecognition( &self, task: &SFSpeechRecognitionTask, recognition_result: &SFSpeechRecognitionResult, )
SFSpeechRecognitionResult only.Tells the delegate when the final utterance is recognized.
When this method is called, the delegate should expect no further information about the utterance to be reported.
- Parameters:
- task: The speech recognition task (an
SFSpeechRecognitionTaskobject) that represents the request. - recognitionResult: A recognized utterance that contains one or more transcription hypotheses in an
SFSpeechRecognitionResultobject.
Sourceunsafe fn speechRecognitionTaskFinishedReadingAudio(
&self,
task: &SFSpeechRecognitionTask,
)
unsafe fn speechRecognitionTaskFinishedReadingAudio( &self, task: &SFSpeechRecognitionTask, )
Tells the delegate when the task is no longer accepting new audio input, even if final processing is in progress.
- Parameters:
- task: The speech recognition task (an
SFSpeechRecognitionTaskobject) that represents the request.
Sourceunsafe fn speechRecognitionTaskWasCancelled(
&self,
task: &SFSpeechRecognitionTask,
)
unsafe fn speechRecognitionTaskWasCancelled( &self, task: &SFSpeechRecognitionTask, )
Tells the delegate that the task has been canceled.
A speech recognition task can be canceled by the user, by your app, or by the system.
- Parameters:
- task: The speech recognition task (an
SFSpeechRecognitionTaskobject) that represents the request.
Sourceunsafe fn speechRecognitionTask_didFinishSuccessfully(
&self,
task: &SFSpeechRecognitionTask,
successfully: bool,
)
unsafe fn speechRecognitionTask_didFinishSuccessfully( &self, task: &SFSpeechRecognitionTask, successfully: bool, )
Tells the delegate when the recognition of all requested utterances is finished.
- Parameters:
- task: The speech recognition task (an
SFSpeechRecognitionTaskobject) that represents the request. - successfully: A Boolean value that indicates whether the task was successful. When this parameter is
false, use theSFSpeechRecognitionTask/errorproperty of the task to get information about why the task was unsuccessful.
Sourceunsafe fn speechRecognitionTask_didProcessAudioDuration(
&self,
task: &SFSpeechRecognitionTask,
duration: NSTimeInterval,
)
unsafe fn speechRecognitionTask_didProcessAudioDuration( &self, task: &SFSpeechRecognitionTask, duration: NSTimeInterval, )
Tells the delegate how much audio has been processed by the task.
- Parameters:
- task: The speech recognition task (an
SFSpeechRecognitionTaskobject) that represents the request. - duration: The seconds of audio input that the recognizer has processed.