pub struct SpeechConfig {
pub handle: SmartHandle<SPXSPEECHCONFIGHANDLE>,
/* private fields */
}
Expand description
SpeechConfig is the class that defines configurations for speech / intent recognition, or speech synthesis.
Fields
handle: SmartHandle<SPXSPEECHCONFIGHANDLE>
Implementations
sourceimpl SpeechConfig
impl SpeechConfig
sourcepub fn from_handle(handle: SPXHANDLE) -> Result<SpeechConfig>
pub fn from_handle(handle: SPXHANDLE) -> Result<SpeechConfig>
Creates a SpeechConfig instance from a valid handle. This is for internal use only.
sourcepub fn from_subscription<S>(subscription: S, region: S) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
pub fn from_subscription<S>(subscription: S, region: S) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
Creates an instance of the speech config with specified subscription key and region.
sourcepub fn from_auth_token<S>(auth_token: S, region: S) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
pub fn from_auth_token<S>(auth_token: S, region: S) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
Creates an instance of the speech config with specified authorization token and region. 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. As configuration values are copied when creating a new recognizer, the new token value will not apply to recognizers that have already been created. For recognizers that have been created before, you need to set authorization token of the corresponding recognizer to refresh the token. Otherwise, the recognizers will encounter errors during recognition.
sourcepub fn from_endpoint_with_subscription<S>(
endpoint: S,
subscription: S
) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
pub fn from_endpoint_with_subscription<S>(
endpoint: S,
subscription: S
) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
and subscription. This method is intended only for users who use a non-standard service endpoint. 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 endoint, use FromEndpoint, and then call SetAuthorizationToken() on the created SpeechConfig instance.
sourcepub fn from_endpoint<S>(endpoint: S) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
pub fn from_endpoint<S>(endpoint: S) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
Creates an instance of SpeechConfig with specified endpoint. This method is intended only for users who use a non-standard service endpoint. 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, use NewSpeechConfigFromEndpointWithSubscription to pass the subscription key as parameter. To use an authorization token with FromEndpoint, use this method to create a SpeechConfig instance, and then call SetAuthorizationToken() on the created SpeechConfig instance.
sourcepub fn from_host_with_subscription<S>(
host: S,
subscription: S
) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
pub fn from_host_with_subscription<S>(
host: S,
subscription: S
) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
Creates an instance of the speech config with specified host and subscription. 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 host, use NewSpeechConfigFromHost, and then call SetAuthorizationToken() on the created SpeechConfig instance.
sourcepub fn from_host<S>(host: S) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
pub fn from_host<S>(host: S) -> Result<SpeechConfig> where
S: Into<Vec<u8>>,
Creates an instance of SpeechConfig 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 NewSpeechConfigFromHostWithSubscription to pass the subscription key as parameter. To use an authorization token with FromHost, use this method to create a SpeechConfig instance, and then call SetAuthorizationToken() on the created SpeechConfig instance.
sourcepub fn set_proxy(&mut self, hostname: String, port: u64) -> Result<()>
pub fn set_proxy(&mut self, hostname: String, port: u64) -> Result<()>
Sets proxy configuration Note: Proxy functionality is not available on macOS. This function will have no effect on this platform.
sourcepub fn set_proxy_with_usrname_and_pwd(
&mut self,
hostname: String,
port: u64,
username: String,
password: String
) -> Result<()>
pub fn set_proxy_with_usrname_and_pwd(
&mut self,
hostname: String,
port: u64,
username: String,
password: String
) -> Result<()>
Sets proxy configuration with username and password Note: Proxy functionality is not available on macOS. This function will have no effect on this platform.
pub fn set_service_property(
&mut self,
name: String,
value: String,
channel: ServicePropertyChannel
) -> Result<()>
pub fn set_profanity_option(
&mut self,
profanity_option: ProfanityOption
) -> Result<()>
pub fn enable_audio_logging(&mut self) -> Result<()>
sourcepub fn request_word_level_timestamps(&mut self) -> Result<()>
pub fn request_word_level_timestamps(&mut self) -> Result<()>
Includes word-level timestamps in response result.
sourcepub fn enable_dictation(&mut self) -> Result<()>
pub fn enable_dictation(&mut self) -> Result<()>
Enables dictation mode. Only supported in speech continuous recognition.
pub fn set_property(&mut self, id: PropertyId, value: String) -> Result<()>
pub fn get_property(&self, id: PropertyId) -> Result<String>
pub fn set_property_by_string(
&mut self,
name: String,
value: String
) -> Result<()>
pub fn get_property_by_string(&self, name: String) -> Result<String>
sourcepub fn get_subscription_key(&self) -> Result<String>
pub fn get_subscription_key(&self) -> Result<String>
Subscription key that is used to create Speech Recognizer or Intent Recognizer or Translation Recognizer or Speech Synthesizer
sourcepub fn get_region(&self) -> Result<String>
pub fn get_region(&self) -> Result<String>
Region key that used to create Speech Recognizer or Intent Recognizer or Translation Recognizer or Speech Synthesizer.
sourcepub fn get_auth_token(&self) -> Result<String>
pub fn get_auth_token(&self) -> Result<String>
Authorization token to connect to the service.
sourcepub fn set_auth_token(&mut self, auth_token: String) -> Result<()>
pub fn set_auth_token(&mut self, auth_token: String) -> Result<()>
Sets the authorization token to connect to 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. As configuration values are copied when creating a new recognizer, the new token value will not apply to recognizers that have already been created. For recognizers that have been created before, you need to set authorization token of the corresponding recognizer to refresh the token. Otherwise, the recognizers will encounter errors during recognition.
sourcepub fn get_speech_recognition_language(&self) -> Result<String>
pub fn get_speech_recognition_language(&self) -> Result<String>
Gets input language to the speech recognition. The language is specified in BCP-47 format.
pub fn set_speech_recognition_language(
&mut self,
reco_lang: String
) -> Result<()>
pub fn get_output_format(&self) -> Result<OutputFormat>
pub fn set_get_output_format(
&mut self,
output_format: OutputFormat
) -> Result<()>
pub fn get_endpoint_id(&self) -> Result<String>
pub fn set_endpoint_id(&mut self, endpoint_id: String) -> Result<()>
pub fn get_speech_synthesis_language(&self) -> Result<String>
pub fn set_get_speech_synthesis_language(
&mut self,
speech_synthesis_language: String
) -> Result<()>
pub fn get_speech_synthesis_voice_name(&self) -> Result<String>
pub fn set_get_speech_synthesis_voice_name(
&mut self,
speech_synthesis_voice_name: String
) -> Result<()>
pub fn get_speech_synthesis_output_format(&self) -> Result<String>
pub fn set_get_speech_synthesis_output_format(
&mut self,
speech_synthesis_output_format: String
) -> Result<()>
Trait Implementations
sourceimpl Debug for SpeechConfig
impl Debug for SpeechConfig
sourceimpl From<EmbeddedSpeechConfig> for SpeechConfig
impl From<EmbeddedSpeechConfig> for SpeechConfig
sourcefn from(esc: EmbeddedSpeechConfig) -> SpeechConfig
fn from(esc: EmbeddedSpeechConfig) -> SpeechConfig
Converts to this type from the input type.
Auto Trait Implementations
impl RefUnwindSafe for SpeechConfig
impl Send for SpeechConfig
impl !Sync for SpeechConfig
impl Unpin for SpeechConfig
impl UnwindSafe for SpeechConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more