Struct rustfst::algorithms::tr_mappers::TimesMapper
source · pub struct TimesMapper<W: Semiring> { /* private fields */ }
Expand description
Mapper to (right) multiply a constant to all weights.
Implementations§
source§impl<W: Semiring> TimesMapper<W>
impl<W: Semiring> TimesMapper<W>
pub fn new(value: W::Type) -> Self
pub fn from_weight(value: W) -> Self
pub fn map_weight(&self, weight: &mut W) -> Result<()>
Trait Implementations§
source§impl<S: Semiring> TrMapper<S> for TimesMapper<S>
impl<S: Semiring> TrMapper<S> for TimesMapper<S>
source§fn final_tr_map(&self, final_tr: &mut FinalTr<S>) -> Result<()>
fn final_tr_map(&self, final_tr: &mut FinalTr<S>) -> Result<()>
The mapper will be passed final weights as trs of the form
FinalTr(EPS_LABEL, EPS_LABEL, weight)
.source§fn final_action(&self) -> MapFinalAction
fn final_action(&self) -> MapFinalAction
Specifies final action the mapper requires (see above).
fn properties(&self, inprops: FstProperties) -> FstProperties
source§impl<S> WeightConverter<S, S> for TimesMapper<S>where
S: Semiring,
impl<S> WeightConverter<S, S> for TimesMapper<S>where
S: Semiring,
fn tr_map(&mut self, tr: &Tr<S>) -> Result<Tr<S>>
fn final_tr_map(&mut self, final_tr: &FinalTr<S>) -> Result<FinalTr<S>>
fn final_action(&self) -> MapFinalAction
fn properties(&self, iprops: FstProperties) -> FstProperties
Auto Trait Implementations§
impl<W> Freeze for TimesMapper<W>where
W: Freeze,
impl<W> RefUnwindSafe for TimesMapper<W>where
W: RefUnwindSafe,
impl<W> Send for TimesMapper<W>where
W: Send,
impl<W> Sync for TimesMapper<W>
impl<W> Unpin for TimesMapper<W>where
W: Unpin,
impl<W> UnwindSafe for TimesMapper<W>where
W: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more