Skip to main content

SegmentLabeler

Struct SegmentLabeler 

Source
pub struct SegmentLabeler<E> { /* private fields */ }
Available on crate feature silero and non-target_family=wasm only.

Implementations§

Source§

impl<E: Embedder> SegmentLabeler<E>

Source

pub fn new(vad: Option<SileroVad>, diarizer: Option<Diarizer<E>>) -> Self

Source

pub fn diarizes(&self) -> bool

Whether a speaker model loaded — without one every label is None and a final relabel has nothing to say.

Source

pub fn set_only_own_voice(&mut self, only_own_voice: bool)

Keeps out segments in a voice that is not the owner’s, judged over the turn so far. Without a speaker model nothing can be judged and everything stays.

Source

pub fn only_own_voice(&self) -> bool

Source

pub fn judges_own_voice(&self) -> bool

Whether a stranger’s voice is actually kept out: the setting is on and there is a model with an owner to judge by. The setting alone promises nothing.

Source

pub fn set_enrolled(&mut self, enrolled: Vec<Profile>)

Replaces the enrolled profiles the diarizer judges against. Without a speaker model there is nothing to hold them.

Source

pub fn own_voice_audio(&mut self, samples: &[f32]) -> Option<Vec<f32>>

The stretches of a finished recording in the owner’s voice, joined in order: what a decode that hears everything at once should be handed. Turns are cut and judged as the live path cuts and judges them. None when everything stays: not keeping strangers out, or no speaker model to judge by.

Source

pub fn observe(&mut self, window: &[f32], silence_before: u64) -> Verdict

silence_before is the samples of gap between the previous segment’s audio and this one’s; zero whenever the timing is unknown. With a speech gate the window’s own silence counts too, since an engine’s timings can stretch a word over a pause.

Source

pub fn relabel(&self, paragraphs: &[Option<Vec<f32>>]) -> Vec<Option<String>>

The final labels for the session’s paragraphs; all None without a speaker model.

Auto Trait Implementations§

§

impl<E> !RefUnwindSafe for SegmentLabeler<E>

§

impl<E> !UnwindSafe for SegmentLabeler<E>

§

impl<E> Freeze for SegmentLabeler<E>
where Option<Diarizer<E>>: Freeze,

§

impl<E> Send for SegmentLabeler<E>
where Option<Diarizer<E>>: Send,

§

impl<E> Sync for SegmentLabeler<E>
where Option<Diarizer<E>>: Sync,

§

impl<E> Unpin for SegmentLabeler<E>
where Option<Diarizer<E>>: Unpin,

§

impl<E> UnsafeUnpin for SegmentLabeler<E>

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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