Class ConversationTranscriber
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.Recognizer
-
- com.microsoft.cognitiveservices.speech.transcription.ConversationTranscriber
-
- All Implemented Interfaces:
AutoCloseable
public final class ConversationTranscriber extends Recognizer
Performs conversation transcribing for audio input streams, and gets transcribed text and speaker id as a result. Note: close() must be called in order to release underlying resources held by the object.
-
-
Field Summary
Fields Modifier and Type Field Description EventHandlerImpl<ConversationTranscriptionCanceledEventArgs>canceledThe event canceled signals that the recognition was canceled.EventHandlerImpl<ConversationTranscriptionEventArgs>transcribedThe event transcribed signals that a final recognition result is received.EventHandlerImpl<ConversationTranscriptionEventArgs>transcribingThe event transcribing signals that an intermediate recognition result is received.-
Fields inherited from class com.microsoft.cognitiveservices.speech.Recognizer
disposed, eventCounter, sessionStarted, sessionStopped, speechEndDetected, speechStartDetected
-
-
Constructor Summary
Constructors Constructor Description ConversationTranscriber(SpeechConfig speechConfig)Initializes a new instance of Conversation Transcriber.ConversationTranscriber(SpeechConfig speechConfig, AudioConfig audioConfig)Initializes a new instance of Conversation Transcriber.ConversationTranscriber(SpeechConfig speechConfig, AutoDetectSourceLanguageConfig autoDetectSourceLangConfig)Initializes a new instance of Conversation Transcriber.ConversationTranscriber(SpeechConfig speechConfig, AutoDetectSourceLanguageConfig autoDetectSourceLangConfig, AudioConfig audioConfig)Initializes a new instance of Conversation Transcriber.ConversationTranscriber(SpeechConfig speechConfig, SourceLanguageConfig sourceLanguageConfig)Initializes a new instance of Conversation Transcriber.ConversationTranscriber(SpeechConfig speechConfig, SourceLanguageConfig sourceLanguageConfig, AudioConfig audioConfig)Initializes a new instance of Conversation Transcriber.ConversationTranscriber(SpeechConfig speechConfig, String sourceLanguage)Initializes a new instance of Conversation Transcriber.ConversationTranscriber(SpeechConfig speechConfig, String sourceLanguage, AudioConfig audioConfig)Initializes a new instance of Conversation Transcriber.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddispose(boolean disposing)This method performs cleanup of resources.StringgetAuthorizationToken()Gets the authorization token used to communicate with the service.OutputFormatgetOutputFormat()Gets the output format of recognition.PropertyCollectiongetProperties()The collection of properties and their values defined for this ConversationTranscriber.StringgetSpeechRecognitionLanguage()Gets the spoken language of recognition.voidsetAuthorizationToken(String token)Sets the authorization token used to communicate with the service.Future<Void>startTranscribingAsync()Starts conversation transcribing on a continuous audio stream, until stopTranscribingAsync() is called.Future<Void>stopTranscribingAsync()Stops conversation transcribing.-
Methods inherited from class com.microsoft.cognitiveservices.speech.Recognizer
canceledSetCallback, close, doAsyncRecognitionAction, getImpl, getPropertyBagFromRecognizerHandle, recognize, recognizedSetCallback, recognizingSetCallback, sessionStartedEventCallback, sessionStartedSetCallback, sessionStoppedEventCallback, sessionStoppedSetCallback, speechEndDetectedEventCallback, speechEndDetectedSetCallback, speechStartDetectedEventCallback, speechStartDetectedSetCallback, startContinuousRecognition, startKeywordRecognition, stopContinuousRecognition, stopKeywordRecognition
-
-
-
-
Field Detail
-
transcribing
public final EventHandlerImpl<ConversationTranscriptionEventArgs> transcribing
The event transcribing signals that an intermediate recognition result is received.
-
transcribed
public final EventHandlerImpl<ConversationTranscriptionEventArgs> transcribed
The event transcribed signals that a final recognition result is received.
-
canceled
public final EventHandlerImpl<ConversationTranscriptionCanceledEventArgs> canceled
The event canceled signals that the recognition was canceled.
-
-
Constructor Detail
-
ConversationTranscriber
public ConversationTranscriber(SpeechConfig speechConfig)
Initializes a new instance of Conversation Transcriber.- Parameters:
speechConfig- speech configuration.
-
ConversationTranscriber
public ConversationTranscriber(SpeechConfig speechConfig, AudioConfig audioConfig)
Initializes a new instance of Conversation Transcriber.- Parameters:
speechConfig- speech configuration.audioConfig- audio configuration.
-
ConversationTranscriber
public ConversationTranscriber(SpeechConfig speechConfig, AutoDetectSourceLanguageConfig autoDetectSourceLangConfig)
Initializes a new instance of Conversation Transcriber.- Parameters:
speechConfig- speech configuration.autoDetectSourceLangConfig- the configuration for auto detecting source language
-
ConversationTranscriber
public ConversationTranscriber(SpeechConfig speechConfig, AutoDetectSourceLanguageConfig autoDetectSourceLangConfig, AudioConfig audioConfig)
Initializes a new instance of Conversation Transcriber.- Parameters:
speechConfig- speech configuration.autoDetectSourceLangConfig- the configuration for auto detecting source languageaudioConfig- audio configuration.
-
ConversationTranscriber
public ConversationTranscriber(SpeechConfig speechConfig, SourceLanguageConfig sourceLanguageConfig)
Initializes a new instance of Conversation Transcriber.- Parameters:
speechConfig- speech configuration.sourceLanguageConfig- the configuration for source language
-
ConversationTranscriber
public ConversationTranscriber(SpeechConfig speechConfig, SourceLanguageConfig sourceLanguageConfig, AudioConfig audioConfig)
Initializes a new instance of Conversation Transcriber.- Parameters:
speechConfig- speech configuration.sourceLanguageConfig- the configuration for source languageaudioConfig- audio configuration.
-
ConversationTranscriber
public ConversationTranscriber(SpeechConfig speechConfig, String sourceLanguage)
Initializes a new instance of Conversation Transcriber.- Parameters:
speechConfig- speech configuration.sourceLanguage- the recognition source language
-
ConversationTranscriber
public ConversationTranscriber(SpeechConfig speechConfig, String sourceLanguage, AudioConfig audioConfig)
Initializes a new instance of Conversation Transcriber.- Parameters:
speechConfig- speech configuration.sourceLanguage- the recognition source languageaudioConfig- audio configuration.
-
-
Method Detail
-
setAuthorizationToken
public void setAuthorizationToken(String token)
Sets the authorization token used to communicate with the 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.- Parameters:
token- Authorization token.
-
getAuthorizationToken
public String getAuthorizationToken()
Gets the authorization token used to communicate with the service.- Returns:
- Authorization token.
-
getSpeechRecognitionLanguage
public String getSpeechRecognitionLanguage()
Gets the spoken language of recognition.- Returns:
- The spoken language of recognition.
-
getOutputFormat
public OutputFormat getOutputFormat()
Gets the output format of recognition.- Returns:
- The output format of recognition.
-
getProperties
public PropertyCollection getProperties()
The collection of properties and their values defined for this ConversationTranscriber.- Returns:
- The collection of properties and their values defined for this ConversationTranscriber.
-
startTranscribingAsync
public Future<Void> startTranscribingAsync()
Starts conversation transcribing on a continuous audio stream, until stopTranscribingAsync() is called. User must subscribe to events to receive transcription results.- Returns:
- A task representing the asynchronous operation that starts the transcription.
-
stopTranscribingAsync
public Future<Void> stopTranscribingAsync()
Stops conversation transcribing.- Returns:
- A task representing the asynchronous operation that stops the transcription.
-
dispose
protected void dispose(boolean disposing)
Description copied from class:RecognizerThis method performs cleanup of resources. The Boolean parameter disposing indicates whether the method is called from Dispose (if disposing is true) or from the finalizer (if disposing is false). Derived classes should override this method to dispose resource if needed.- Overrides:
disposein classRecognizer- Parameters:
disposing- Flag to request disposal.
-
-