#[non_exhaustive]pub struct WordInfo {
pub start_offset: Option<Duration>,
pub end_offset: Option<Duration>,
pub word: String,
pub confidence: f32,
pub speaker_label: String,
/* private fields */
}Expand description
Word-specific information for recognized words.
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.start_offset: Option<Duration>Time offset relative to the beginning of the audio,
and corresponding to the start of the spoken word.
This field is only set if
enable_word_time_offsets
is true and only in the top hypothesis. This is an experimental feature
and the accuracy of the time offset can vary.
end_offset: Option<Duration>Time offset relative to the beginning of the audio,
and corresponding to the end of the spoken word.
This field is only set if
enable_word_time_offsets
is true and only in the top hypothesis. This is an experimental feature
and the accuracy of the time offset can vary.
word: StringThe word corresponding to this set of information.
confidence: f32The confidence estimate between 0.0 and 1.0. A higher number
indicates an estimated greater likelihood that the recognized words are
correct. This field is set only for the top alternative of a non-streaming
result or, of a streaming result where
is_final is
set to true. This field is not guaranteed to be accurate and users should
not rely on it to be always provided. The default of 0.0 is a sentinel
value indicating confidence was not set.
speaker_label: StringA distinct label is assigned for every speaker within the audio. This field
specifies which one of those speakers was detected to have spoken this
word. speaker_label is set if
SpeakerDiarizationConfig
is given and only in the top alternative.
Implementations§
Source§impl WordInfo
impl WordInfo
pub fn new() -> Self
Sourcepub fn set_start_offset<T>(self, v: T) -> Self
pub fn set_start_offset<T>(self, v: T) -> Self
Sets the value of start_offset.
§Example
use wkt::Duration;
let x = WordInfo::new().set_start_offset(Duration::default()/* use setters */);Sourcepub fn set_or_clear_start_offset<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_start_offset<T>(self, v: Option<T>) -> Self
Sets or clears the value of start_offset.
§Example
use wkt::Duration;
let x = WordInfo::new().set_or_clear_start_offset(Some(Duration::default()/* use setters */));
let x = WordInfo::new().set_or_clear_start_offset(None::<Duration>);Sourcepub fn set_end_offset<T>(self, v: T) -> Self
pub fn set_end_offset<T>(self, v: T) -> Self
Sets the value of end_offset.
§Example
use wkt::Duration;
let x = WordInfo::new().set_end_offset(Duration::default()/* use setters */);Sourcepub fn set_or_clear_end_offset<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_end_offset<T>(self, v: Option<T>) -> Self
Sets or clears the value of end_offset.
§Example
use wkt::Duration;
let x = WordInfo::new().set_or_clear_end_offset(Some(Duration::default()/* use setters */));
let x = WordInfo::new().set_or_clear_end_offset(None::<Duration>);