SpeechTranslationConfig Class
- java.
lang. Object - com.
microsoft. cognitiveservices. speech. SpeechConfig - com.
microsoft. cognitiveservices. speech. translation. SpeechTranslationConfig
- com.
- com.
Implements
public final class SpeechTranslationConfig
extends SpeechConfig
implements java.lang.AutoCloseable
Speech translation configuration. Note: close() must be called in order to release underlying resources held by the object.
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
addTargetLanguage(String value)
Adds a (text) target language for translation. |
void |
close()
Dispose of associated resources. |
static
Speech |
fromAuthorizationToken(String authorizationToken, String region)
Static instance of Speech |
static
Speech |
fromEndpoint(URI endpoint)
Creates an instance of the speech translation config with specified endpoint. |
static
Speech |
fromEndpoint(URI endpoint, String subscriptionKey)
Creates an instance of the speech translation config with specified endpoint and subscription key. |
static
Speech |
fromHost(URI host)
Creates an instance of the speech translation config with specified host. |
static
Speech |
fromHost(URI host, String subscriptionKey)
Creates an instance of the speech translation config with specified host and subscription key. |
static
Speech |
fromSubscription(String subscriptionKey, String region)
Static instance of Speech |
Safe |
getImpl()
Returns the speech translation config implementation |
java.util.ArrayList<java.lang.String> |
getTargetLanguages()
Gets all target languages that have been configured for translation. |
java.lang.String |
getVoiceName()
Returns the selected voice name. |
void |
removeTargetLanguage(String value)
Removes a (text) target language for translation. |
void |
setCustomModelCategoryId(String categoryId)
Sets a Category Id that will be passed to service. |
void |
setVoiceName(String value)
Sets voice of the translated language, enable voice synthesis output. |
Methods inherited from SpeechConfig
Methods inherited from java.lang.Object
Method Details
addTargetLanguage
public void addTargetLanguage(String value)
Adds a (text) target language for translation.
Parameters:
close
public void close()
Dispose of associated resources.
Overrides:
SpeechTranslationConfig.close()fromAuthorizationToken
public static SpeechTranslationConfig fromAuthorizationToken(String authorizationToken, String region)
Static instance of SpeechTranslationConfig returned by passing authorization token and service region. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expipres, the caller needs to refresh it by calling this setter with a new valid token. Otherwise, all the recognizers created by this SpeechTranslationConfig instance will encounter errors during recognition.
Parameters:
Returns:
fromEndpoint
public static SpeechTranslationConfig fromEndpoint(URI endpoint)
Creates an instance of the speech translation config with specified endpoint. This method is intended only for users who use a non-standard service endpoint or parameters. Note: The query parameters specified in the endpoint URI are not changed, even if they are set by any other APIs. For example, if the recognition language is defined in URI as query parameter "language=de-DE", and also set by setSpeechRecognitionLanguage("en-US"), the language setting in URI takes precedence, and the effective language is "de-DE". Only the parameters that are not specified in the endpoint URI can be set by other APIs. Note: if the endpoint requires a subscription key for authentication, please use fromEndpoint(java.net.URI, String) to pass the subscription key as parameter. To use an authorization token with fromEndpoint, please use this method to create a SpeechTranslationConfig instance, and then call setAuthorizationToken() on the created SpeechTranslationConfig instance. Note: Added in version 1.5.0.
Parameters:
Returns:
fromEndpoint
public static SpeechTranslationConfig fromEndpoint(URI endpoint, String subscriptionKey)
Creates an instance of the speech translation config with specified endpoint and subscription key. This method is intended only for users who use a non-standard service endpoint or parameters. Note: The query parameters specified in the endpoint URI are not changed, even if they are set by any other APIs. For example, if the recognition language is defined in URI as query parameter "language=de-DE", and also set by setSpeechRecognitionLanguage("en-US"), the language setting in URI takes precedence, and the effective language is "de-DE". Only the parameters that are not specified in the endpoint URI can be set by other APIs. Note: To use an authorization token with fromEndpoint, please use fromEndpoint(java.net.URI), and then call setAuthorizationToken() on the created SpeechTranslationConfig instance.
Parameters:
Returns:
fromHost
public static SpeechTranslationConfig fromHost(URI host)
Creates an instance of the speech translation config with specified host. This method is intended only for users who use a non-default service host. Standard resource path will be assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead. Note: Query parameters are not allowed in the host URI and must be set by other APIs. Note: If the host requires a subscription key for authentication, use fromHost(java.net.URI, String) to pass the subscription key as parameter. To use an authorization token with fromHost, use this method to create a SpeechTranslationConfig instance, and then call setAuthorizationToken() on the created SpeechTranslationConfig instance. Note: Added in version 1.8.0.
Parameters:
Returns:
fromHost
public static SpeechTranslationConfig fromHost(URI host, String subscriptionKey)
Creates an instance of the speech translation config with specified host and subscription key. This method is intended only for users who use a non-default service host. Standard resource path will be assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead. Note: Query parameters are not allowed in the host URI and must be set by other APIs. Note: To use an authorization token with fromHost, use fromHost(java.net.URI), and then call setAuthorizationToken() on the created SpeechTranslationConfig instance. Note: Added in version 1.8.0.
Parameters:
Returns:
fromSubscription
public static SpeechTranslationConfig fromSubscription(String subscriptionKey, String region)
Static instance of SpeechTranslationConfig returned by passing subscriptionKey and service region.
Parameters:
Returns:
getImpl
public SafeHandle getImpl()
Returns the speech translation config implementation
Overrides:
SpeechTranslationConfig.getImpl()Returns:
getTargetLanguages
public ArrayList
Gets all target languages that have been configured for translation.
Returns:
getVoiceName
public String getVoiceName()
Returns the selected voice name.
Returns:
removeTargetLanguage
public void removeTargetLanguage(String value)
Removes a (text) target language for translation. Added in version 1.7.0.
Parameters:
setCustomModelCategoryId
public void setCustomModelCategoryId(String categoryId)
Sets a Category Id that will be passed to service. Category Id is used to find the custom model.
Parameters:
setVoiceName
public void setVoiceName(String value)
Sets voice of the translated language, enable voice synthesis output.
Parameters:
Applies to
Azure SDK for Java