RecognitionConfig

Struct RecognitionConfig 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§model: String

Optional. 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

Source

pub fn new() -> Self

Source

pub fn set_model<T: Into<String>>(self, v: T) -> Self

Sets the value of model.

§Example
let x = RecognitionConfig::new().set_model("example");
Source

pub fn set_language_codes<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<String>,

Sets the value of language_codes.

§Example
let x = RecognitionConfig::new().set_language_codes(["a", "b", "c"]);
Source

pub fn set_features<T>(self, v: T) -> Self

Sets the value of features.

§Example
use google_cloud_speech_v2::model::RecognitionFeatures;
let x = RecognitionConfig::new().set_features(RecognitionFeatures::default()/* use setters */);
Source

pub fn set_or_clear_features<T>(self, v: Option<T>) -> Self

Sets or clears the value of features.

§Example
use google_cloud_speech_v2::model::RecognitionFeatures;
let x = RecognitionConfig::new().set_or_clear_features(Some(RecognitionFeatures::default()/* use setters */));
let x = RecognitionConfig::new().set_or_clear_features(None::<RecognitionFeatures>);
Source

pub fn set_adaptation<T>(self, v: T) -> Self

Sets the value of adaptation.

§Example
use google_cloud_speech_v2::model::SpeechAdaptation;
let x = RecognitionConfig::new().set_adaptation(SpeechAdaptation::default()/* use setters */);
Source

pub fn set_or_clear_adaptation<T>(self, v: Option<T>) -> Self

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>);
Source

pub fn set_transcript_normalization<T>(self, v: T) -> Self

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 */);
Source

pub fn set_or_clear_transcript_normalization<T>(self, v: Option<T>) -> Self

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>);
Source

pub fn set_translation_config<T>(self, v: T) -> Self

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 */);
Source

pub fn set_or_clear_translation_config<T>(self, v: Option<T>) -> Self

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>);
Source

pub fn set_denoiser_config<T>(self, v: T) -> Self
where 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 */);
Source

pub fn set_or_clear_denoiser_config<T>(self, v: Option<T>) -> Self
where 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>);
Source

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())));
Source

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.

Source

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());
Source

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.

Source

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

Source§

fn clone(&self) -> RecognitionConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RecognitionConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RecognitionConfig

Source§

fn default() -> RecognitionConfig

Returns the “default value” for a type. Read more
Source§

impl Message for RecognitionConfig

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for RecognitionConfig

Source§

fn eq(&self, other: &RecognitionConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RecognitionConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,