Compartir a través de


Class SPXConversationTranscriber

Declaration

@class SPXConversationTranscriber : SPXRecognizer;

Description

Performs conversation transcribing for audio input streams, and gets transcribed text and user id as a result.

Methods

init:

Initializes a new instance of a conversation transcriber.

- (instancetype _Nullable)init:(SPXSpeechConfiguration * _Nonnull)speechConfiguration

Parameters

  • speechConfiguration - speech configuration for conversation transcription.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:audioConfiguration:

Initializes a new instance of conversation transcriber using the specified audio config.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    audioConfiguration:(SPXAudioConfiguration * _Nonnull)audioConfiguration

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • audioConfiguration - audio configuration.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:audioConfiguration:error:

Initializes a new instance of conversation transcriber using the specified audio config.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    audioConfiguration:(SPXAudioConfiguration * _Nonnull)audioConfiguration
    error:(NSError * _Nullable * _Nullable)outError

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • audioConfiguration - audio configuration.
  • outError - error information.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:language:

Initializes a new instance of conversation transcriber using the specified source language.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    language:(NSString * _Nonnull)language

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • language - source language.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:language:error:

Initializes a new instance of conversation transcriber using the specified source language.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    language:(NSString * _Nonnull)language error:(NSError * _Nullable * _Nullable)outError

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • language - source language.
  • outError - error information.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:language:audioConfiguration:

Initializes a new instance of conversation transcriber using the specified source language and audio configuration.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    language:(NSString * _Nonnull)language
    audioConfiguration:(SPXAudioConfiguration * _Nonnull)audioConfiguration

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • language - source language.
  • audioConfiguration - audio configuration.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:language:audioConfiguration:error:

Initializes a new instance of conversation transcriber using the specified source language and audio configuration.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    language:(NSString * _Nonnull)language
    audioConfiguration:(SPXAudioConfiguration * _Nonnull)audioConfiguration
    error:(NSError * _Nullable * _Nullable)outError

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • language - source language.
  • audioConfiguration - audio configuration.
  • outError - error information.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:sourceLanguageConfiguration:

Initializes a new instance of conversation transcriber using the specified source language configuration.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    sourceLanguageConfiguration:(SPXSourceLanguageConfiguration * _Nonnull)sourceLanguageConfiguration

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • sourceLanguageConfiguration - the source language configuration.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:sourceLanguageConfiguration:error:

Initializes a new instance of conversation transcriber using the specified source language configuration.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    sourceLanguageConfiguration:(SPXSourceLanguageConfiguration * _Nonnull)sourceLanguageConfiguration
    error:(NSError * _Nullable * _Nullable)outError

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • sourceLanguageConfiguration - the source language configuration.
  • outError - error information.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:sourceLanguageConfiguration:audioConfiguration:

Initializes a new instance of conversation transcriber using the specified source language configuration and audio configuration.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    sourceLanguageConfiguration:(SPXSourceLanguageConfiguration * _Nonnull)sourceLanguageConfiguration
    audioConfiguration:(SPXAudioConfiguration * _Nonnull)audioConfiguration

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • sourceLanguageConfiguration - the source language configuration.
  • audioConfiguration - audio configuration.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:sourceLanguageConfiguration:audioConfiguration:error:

Initializes a new instance of conversation transcriber using the specified source language configuration and audio configuration.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    sourceLanguageConfiguration:(SPXSourceLanguageConfiguration * _Nonnull)sourceLanguageConfiguration
    audioConfiguration:(SPXAudioConfiguration * _Nonnull)audioConfiguration
    error:(NSError * _Nullable * _Nullable)outError

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • sourceLanguageConfiguration - the source language configuration.
  • audioConfiguration - audio configuration.
  • outError - error information.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:autoDetectSourceLanguageConfiguration:

Initializes a new instance of conversation transcriber using the specified configuration for auto language detection.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    autoDetectSourceLanguageConfiguration:(SPXAutoDetectSourceLanguageConfiguration * _Nonnull)autoDetectSourceLanguageConfiguration

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • autoDetectSourceLanguageConfiguration - the configuration for auto language detection.

Returns

a conversation transcriber instance..

initWithSpeechConfiguration:autoDetectSourceLanguageConfiguration:error:

Initializes a new instance of conversation transcriber using the specified configuration for auto language detection.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    autoDetectSourceLanguageConfiguration:(SPXAutoDetectSourceLanguageConfiguration * _Nonnull)autoDetectSourceLanguageConfiguration
    error:(NSError * _Nullable * _Nullable)outError

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • autoDetectSourceLanguageConfiguration - the configuration for auto language detection.
  • outError - error information.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:autoDetectSourceLanguageConfiguration:audioConfiguration:

Initializes a new instance of conversation transcriber using the specified configuration for auto language detection and audio configuration.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    autoDetectSourceLanguageConfiguration:(SPXAutoDetectSourceLanguageConfiguration * _Nonnull)autoDetectSourceLanguageConfiguration
    audioConfiguration:(SPXAudioConfiguration * _Nonnull)audioConfiguration

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • autoDetectSourceLanguageConfiguration - the configuration for auto language detection.
  • audioConfiguration - audio configuration.

Returns

a conversation transcriber instance.

initWithSpeechConfiguration:autoDetectSourceLanguageConfiguration:audioConfiguration:error:

Initializes a new instance of conversation transcriber using the specified configuration for auto language detection and audio configuration.

- (instancetype _Nullable)initWithSpeechConfiguration:(SPXSpeechConfiguration * _Nonnull)speechConfiguration
    autoDetectSourceLanguageConfiguration:(SPXAutoDetectSourceLanguageConfiguration * _Nonnull)autoDetectSourceLanguageConfiguration
    audioConfiguration:(SPXAudioConfiguration * _Nonnull)audioConfiguration
    error:(NSError * _Nullable * _Nullable)outError

Parameters

  • speechConfiguration - speech configuration for conversation transcription.
  • autoDetectSourceLanguageConfiguration - the configuration for auto language detection.
  • audioConfiguration - audio configuration.
  • outError - error information.

Returns

a conversation transcriber instance.

startTranscribingAsync:

Starts conversation transcribing on a continuous audio stream, until stopTranscribingAsync() is called. User must subscribe to events to receive transcription results.

- (void)startTranscribingAsync:(void (^ _Nonnull)(BOOL, NSError * _Nullable))completedHandler

Parameters

  • completedHandler - the block function to be called when async operation has been completed.

startTranscribingAsync:error:

Starts conversation transcribing on a continuous audio stream, until stopTranscribingAsync() is called. User must subscribe to events to receive transcription results.

- (BOOL)startTranscribingAsync:(void (^ _Nonnull)(BOOL, NSError * _Nullable))completedHandler
    error:(NSError * _Nullable * _Nullable)outError

Parameters

  • completedHandler - the block function to be called when async operation has been completed.
  • outError - error information.

stopTranscribingAsync:

Stops conversation transcribing.

- (void)stopTranscribingAsync:(void (^ _Nonnull)(BOOL, NSError * _Nullable))completedHandler

Parameters

  • completedHandler - the block function to be called when async operation has been completed.

stopTranscribingAsync:error:

Stops conversation transcribing.

- (BOOL)stopTranscribingAsync:(void (^ _Nonnull)(BOOL, NSError * _Nullable))completedHandler
    error:(NSError * _Nullable * _Nullable)outError

Parameters

  • completedHandler - the block function to be called when async operation has been completed.
  • outError - error information.

addTranscribedEventHandler:

Subscribes to the Transcribed event which indicates that a final result has been transcribed.

- (void)addTranscribedEventHandler:(SPXConversationTranscriptionEventHandler _Nonnull)eventHandler

addTranscribingEventHandler:

Subscribes to the Transcribing event which indicates an that intermediate result has been transcribed.

- (void)addTranscribingEventHandler:(SPXConversationTranscriptionEventHandler _Nonnull)eventHandler

addCanceledEventHandler:

Subscribes to the Canceled event which indicates that an error occurred during transcription.

- (void)addCanceledEventHandler:(SPXConversationTranscriptionCanceledEventHandler _Nonnull)eventHandler

Properties

authorizationToken

@property (readwrite, copy, nonatomic) NSString * _Nullable authorizationToken;

The authorization token used to communicate with the conversation transcription service. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, the recognizer will encounter errors during recognition.