您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

SpeechTranslationConfig Class

Definition

Speech translation configuration.

public class SpeechTranslationConfig extends SpeechConfig
Inheritance
java.lang.Object
Closeable
SpeechTranslationConfig

Inherited Members

Methods

addTargetLanguage(String value)

Adds a (text) target language for translation.

close()

Dispose of associated resources.

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.

fromEndpoint(java.net.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.

fromEndpoint(java.net.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.

fromHost(java.net.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.

fromHost(java.net.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.

fromSubscription(String subscriptionKey, String region)

Static instance of SpeechTranslationConfig returned by passing subscriptionKey and service region.

getTargetLanguages()

Gets all target languages that have been configured for translation.

getVoiceName()

Returns the selected voice name.

removeTargetLanguage(String value)

Removes a (text) target language for translation. Added in version 1.7.0.

setVoiceName(String value)

Sets voice of the translated language, enable voice synthesis output.

Applies to