ASRAgentProtocol

public protocol ASRAgentProtocol : CapabilityAgentable

ASR (AutomaticSpeechRecognition) is responsible for capturing the audio and delivering it to the server and receiving the result of speech recognition.

  • Adds a delegate to be notified of ASRAgent state changes.

    Declaration

    Swift

    func add(delegate: ASRAgentDelegate)

    Parameters

    delegate

    The object to add.

  • Removes a delegate from ASRAgent.

    Declaration

    Swift

    func remove(delegate: ASRAgentDelegate)

    Parameters

    delegate

    The object to remove.

  • This function asks the ASRAgent to send a Recognize Event to Server and start streaming from AudioStream, which transitions it to the recognizing state.

    This function can be called in idle and expectingSpeech state.

    Declaration

    Swift

    @discardableResult
    func startRecognition(
        initiator: ASRInitiator,
        completion: ((StreamDataState) -> Void)?
    ) -> String

    Parameters

    options

    The options for recognition.

    completion

    The completion handler to call when the request is complete.

    Return Value

    The dialogRequestId for request.

  • Put the audio buffer to be processed.

    Declaration

    Swift

    func putAudioBuffer(buffer: AVAudioPCMBuffer)
  • This function forces the ASRAgent back to the idle state.

    This function can be called in any state, and will end any Event which is currently in progress.

    Declaration

    Swift

    func stopRecognition()

Default

  • startRecognition(initiator:) Extension method

    This function asks the ASRAgent to send a Recognize Event to Server and start streaming from AudioStream, which transitions it to the recognizing state.

    This function can be called in idle and expectingSpeech state.

    Declaration

    Swift

    @discardableResult
    func startRecognition(initiator: ASRInitiator) -> String

    Parameters

    options

    The options for recognition.

    Return Value

    The dialogRequestId for request.