#[non_exhaustive]pub struct RecognitionConfig {
pub model: String,
pub language_codes: Vec<String>,
pub features: Option<RecognitionFeatures>,
pub adaptation: Option<SpeechAdaptation>,
pub transcript_normalization: Option<TranscriptNormalization>,
pub translation_config: Option<TranslationConfig>,
pub denoiser_config: Option<DenoiserConfig>,
pub decoding_config: Option<DecodingConfig>,
/* private fields */
}Expand description
Provides information to the Recognizer that specifies how to process the recognition request.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model: StringOptional. Which model to use for recognition requests. Select the model best suited to your domain to get best results.
Guidance for choosing which model to use can be found in the Transcription Models Documentation and the models supported in each region can be found in the Table Of Supported Models.
language_codes: Vec<String>Optional. The language of the supplied audio as a BCP-47 language tag. Language tags are normalized to BCP-47 before they are used eg “en-us” becomes “en-US”.
Supported languages for each model are listed in the Table of Supported Models.
If additional languages are provided, recognition result will contain recognition in the most likely language detected. The recognition result will include the language tag of the language detected in the audio.
features: Option<RecognitionFeatures>Speech recognition features to enable.
adaptation: Option<SpeechAdaptation>Speech adaptation context that weights recognizer predictions for specific words and phrases.
transcript_normalization: Option<TranscriptNormalization>Optional. Use transcription normalization to automatically replace parts of the transcript with phrases of your choosing. For StreamingRecognize, this normalization only applies to stable partial transcripts (stability > 0.8) and final transcripts.
translation_config: Option<TranslationConfig>Optional. Optional configuration used to automatically run translation on the given audio to the desired language for supported models.
denoiser_config: Option<DenoiserConfig>Optional. Optional denoiser config. May not be supported for all models and may have no effect.
decoding_config: Option<DecodingConfig>Decoding parameters for audio being sent for recognition.
Implementations§
Source§impl RecognitionConfig
impl RecognitionConfig
pub fn new() -> Self
Sourcepub fn set_language_codes<T, V>(self, v: T) -> Self
pub fn set_language_codes<T, V>(self, v: T) -> Self
Sets the value of language_codes.
§Example
let x = RecognitionConfig::new().set_language_codes(["a", "b", "c"]);Sourcepub fn set_features<T>(self, v: T) -> Selfwhere
T: Into<RecognitionFeatures>,
pub fn set_features<T>(self, v: T) -> Selfwhere
T: Into<RecognitionFeatures>,
Sourcepub fn set_or_clear_features<T>(self, v: Option<T>) -> Selfwhere
T: Into<RecognitionFeatures>,
pub fn set_or_clear_features<T>(self, v: Option<T>) -> Selfwhere
T: Into<RecognitionFeatures>,
Sourcepub fn set_adaptation<T>(self, v: T) -> Selfwhere
T: Into<SpeechAdaptation>,
pub fn set_adaptation<T>(self, v: T) -> Selfwhere
T: Into<SpeechAdaptation>,
Sets the value of adaptation.
§Example
use google_cloud_speech_v2::model::SpeechAdaptation;
let x = RecognitionConfig::new().set_adaptation(SpeechAdaptation::default()/* use setters */);Sourcepub fn set_or_clear_adaptation<T>(self, v: Option<T>) -> Selfwhere
T: Into<SpeechAdaptation>,
pub fn set_or_clear_adaptation<T>(self, v: Option<T>) -> Selfwhere
T: Into<SpeechAdaptation>,
Sets or clears the value of adaptation.
§Example
use google_cloud_speech_v2::model::SpeechAdaptation;
let x = RecognitionConfig::new().set_or_clear_adaptation(Some(SpeechAdaptation::default()/* use setters */));
let x = RecognitionConfig::new().set_or_clear_adaptation(None::<SpeechAdaptation>);Sourcepub fn set_transcript_normalization<T>(self, v: T) -> Selfwhere
T: Into<TranscriptNormalization>,
pub fn set_transcript_normalization<T>(self, v: T) -> Selfwhere
T: Into<TranscriptNormalization>,
Sets the value of transcript_normalization.
§Example
use google_cloud_speech_v2::model::TranscriptNormalization;
let x = RecognitionConfig::new().set_transcript_normalization(TranscriptNormalization::default()/* use setters */);Sourcepub fn set_or_clear_transcript_normalization<T>(self, v: Option<T>) -> Selfwhere
T: Into<TranscriptNormalization>,
pub fn set_or_clear_transcript_normalization<T>(self, v: Option<T>) -> Selfwhere
T: Into<TranscriptNormalization>,
Sets or clears the value of transcript_normalization.
§Example
use google_cloud_speech_v2::model::TranscriptNormalization;
let x = RecognitionConfig::new().set_or_clear_transcript_normalization(Some(TranscriptNormalization::default()/* use setters */));
let x = RecognitionConfig::new().set_or_clear_transcript_normalization(None::<TranscriptNormalization>);Sourcepub fn set_translation_config<T>(self, v: T) -> Selfwhere
T: Into<TranslationConfig>,
pub fn set_translation_config<T>(self, v: T) -> Selfwhere
T: Into<TranslationConfig>,
Sets the value of translation_config.
§Example
use google_cloud_speech_v2::model::TranslationConfig;
let x = RecognitionConfig::new().set_translation_config(TranslationConfig::default()/* use setters */);Sourcepub fn set_or_clear_translation_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<TranslationConfig>,
pub fn set_or_clear_translation_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<TranslationConfig>,
Sets or clears the value of translation_config.
§Example
use google_cloud_speech_v2::model::TranslationConfig;
let x = RecognitionConfig::new().set_or_clear_translation_config(Some(TranslationConfig::default()/* use setters */));
let x = RecognitionConfig::new().set_or_clear_translation_config(None::<TranslationConfig>);Sourcepub fn set_denoiser_config<T>(self, v: T) -> Selfwhere
T: Into<DenoiserConfig>,
pub fn set_denoiser_config<T>(self, v: T) -> Selfwhere
T: Into<DenoiserConfig>,
Sets the value of denoiser_config.
§Example
use google_cloud_speech_v2::model::DenoiserConfig;
let x = RecognitionConfig::new().set_denoiser_config(DenoiserConfig::default()/* use setters */);Sourcepub fn set_or_clear_denoiser_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<DenoiserConfig>,
pub fn set_or_clear_denoiser_config<T>(self, v: Option<T>) -> Selfwhere
T: Into<DenoiserConfig>,
Sets or clears the value of denoiser_config.
§Example
use google_cloud_speech_v2::model::DenoiserConfig;
let x = RecognitionConfig::new().set_or_clear_denoiser_config(Some(DenoiserConfig::default()/* use setters */));
let x = RecognitionConfig::new().set_or_clear_denoiser_config(None::<DenoiserConfig>);Sourcepub fn set_decoding_config<T: Into<Option<DecodingConfig>>>(self, v: T) -> Self
pub fn set_decoding_config<T: Into<Option<DecodingConfig>>>(self, v: T) -> Self
Sets the value of decoding_config.
Note that all the setters affecting decoding_config are mutually
exclusive.
§Example
use google_cloud_speech_v2::model::AutoDetectDecodingConfig;
let x = RecognitionConfig::new().set_decoding_config(Some(
google_cloud_speech_v2::model::recognition_config::DecodingConfig::AutoDecodingConfig(AutoDetectDecodingConfig::default().into())));Sourcepub fn auto_decoding_config(&self) -> Option<&Box<AutoDetectDecodingConfig>>
pub fn auto_decoding_config(&self) -> Option<&Box<AutoDetectDecodingConfig>>
The value of decoding_config
if it holds a AutoDecodingConfig, None if the field is not set or
holds a different branch.
Sourcepub fn set_auto_decoding_config<T: Into<Box<AutoDetectDecodingConfig>>>(
self,
v: T,
) -> Self
pub fn set_auto_decoding_config<T: Into<Box<AutoDetectDecodingConfig>>>( self, v: T, ) -> Self
Sets the value of decoding_config
to hold a AutoDecodingConfig.
Note that all the setters affecting decoding_config are
mutually exclusive.
§Example
use google_cloud_speech_v2::model::AutoDetectDecodingConfig;
let x = RecognitionConfig::new().set_auto_decoding_config(AutoDetectDecodingConfig::default()/* use setters */);
assert!(x.auto_decoding_config().is_some());
assert!(x.explicit_decoding_config().is_none());Sourcepub fn explicit_decoding_config(&self) -> Option<&Box<ExplicitDecodingConfig>>
pub fn explicit_decoding_config(&self) -> Option<&Box<ExplicitDecodingConfig>>
The value of decoding_config
if it holds a ExplicitDecodingConfig, None if the field is not set or
holds a different branch.
Sourcepub fn set_explicit_decoding_config<T: Into<Box<ExplicitDecodingConfig>>>(
self,
v: T,
) -> Self
pub fn set_explicit_decoding_config<T: Into<Box<ExplicitDecodingConfig>>>( self, v: T, ) -> Self
Sets the value of decoding_config
to hold a ExplicitDecodingConfig.
Note that all the setters affecting decoding_config are
mutually exclusive.
§Example
use google_cloud_speech_v2::model::ExplicitDecodingConfig;
let x = RecognitionConfig::new().set_explicit_decoding_config(ExplicitDecodingConfig::default()/* use setters */);
assert!(x.explicit_decoding_config().is_some());
assert!(x.auto_decoding_config().is_none());Trait Implementations§
Source§impl Clone for RecognitionConfig
impl Clone for RecognitionConfig
Source§fn clone(&self) -> RecognitionConfig
fn clone(&self) -> RecognitionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more