SFSpeechRecognitionTaskDelegate

Trait SFSpeechRecognitionTaskDelegate 

Source
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 { ... }
}
Available on crate feature 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§

Source

unsafe fn speechRecognitionDidDetectSpeech( &self, task: &SFSpeechRecognitionTask, )
where Self: Sized + Message,

Tells the delegate when the task first detects speech in the source audio.

  • Parameters:
  • task: The speech recognition task (an SFSpeechRecognitionTask object) that represents the request.
Source

unsafe fn speechRecognitionTask_didHypothesizeTranscription( &self, task: &SFSpeechRecognitionTask, transcription: &SFTranscription, )
where Self: Sized + Message,

Available on crate feature 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 SFSpeechRecognitionTask object) that represents the request.
  • transcription: The hypothesized transcription in an SFTranscription object.
Source

unsafe fn speechRecognitionTask_didFinishRecognition( &self, task: &SFSpeechRecognitionTask, recognition_result: &SFSpeechRecognitionResult, )
where Self: Sized + Message,

Available on crate feature 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 SFSpeechRecognitionTask object) that represents the request.
  • recognitionResult: A recognized utterance that contains one or more transcription hypotheses in an SFSpeechRecognitionResult object.
Source

unsafe fn speechRecognitionTaskFinishedReadingAudio( &self, task: &SFSpeechRecognitionTask, )
where Self: Sized + Message,

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 SFSpeechRecognitionTask object) that represents the request.
Source

unsafe fn speechRecognitionTaskWasCancelled( &self, task: &SFSpeechRecognitionTask, )
where Self: Sized + Message,

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 SFSpeechRecognitionTask object) that represents the request.
Source

unsafe fn speechRecognitionTask_didFinishSuccessfully( &self, task: &SFSpeechRecognitionTask, successfully: bool, )
where Self: Sized + Message,

Tells the delegate when the recognition of all requested utterances is finished.

  • Parameters:
  • task: The speech recognition task (an SFSpeechRecognitionTask object) that represents the request.
  • successfully: A Boolean value that indicates whether the task was successful. When this parameter is false, use the SFSpeechRecognitionTask/error property of the task to get information about why the task was unsuccessful.
Source

unsafe fn speechRecognitionTask_didProcessAudioDuration( &self, task: &SFSpeechRecognitionTask, duration: NSTimeInterval, )
where Self: Sized + Message,

Tells the delegate how much audio has been processed by the task.

  • Parameters:
  • task: The speech recognition task (an SFSpeechRecognitionTask object) that represents the request.
  • duration: The seconds of audio input that the recognizer has processed.

Trait Implementations§

Source§

impl ProtocolType for dyn SFSpeechRecognitionTaskDelegate

Source§

const NAME: &'static str = "SFSpeechRecognitionTaskDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn SFSpeechRecognitionTaskDelegate

Implementations on Foreign Types§

Source§

impl<T> SFSpeechRecognitionTaskDelegate for ProtocolObject<T>

Implementors§