Trait rustfst::Semiring

source ·
pub trait Semiring: Clone + PartialEq + PartialOrd + Debug + Hash + Eq + Sync + 'static {
    type Type: Clone + Debug;
    type ReverseWeight: Semiring + ReverseBack<Self>;

Show 15 methods fn zero() -> Self; fn one() -> Self; fn new(value: Self::Type) -> Self; fn plus_assign<P: Borrow<Self>>(&mut self, rhs: P) -> Result<()>; fn times_assign<P: Borrow<Self>>(&mut self, rhs: P) -> Result<()>; fn approx_equal<P: Borrow<Self>>(&self, rhs: P, delta: f32) -> bool; fn value(&self) -> &Self::Type; fn take_value(self) -> Self::Type; fn set_value(&mut self, value: Self::Type); fn reverse(&self) -> Result<Self::ReverseWeight>; fn properties() -> SemiringProperties; fn plus<P: Borrow<Self>>(&self, rhs: P) -> Result<Self> { ... } fn times<P: Borrow<Self>>(&self, rhs: P) -> Result<Self> { ... } fn is_one(&self) -> bool { ... } fn is_zero(&self) -> bool { ... }
}
Expand description

The weight on an Fst must implement the Semiring trait. Indeed, the weight set associated to a Fst must have the structure of a semiring. (S, +, *, 0, 1) is a semiring if (S, +, 0) is a commutative monoid with identity element 0, (S, *, 1) is a monoid with identity element 1, * distributes over +, 0 is an annihilator for *. Thus, a semiring is a ring that may lack negation. For more information : https://cs.nyu.edu/~mohri/pub/hwa.pdf

Required Associated Types§

Required Methods§

Borrow underneath value.

Move underneath value.

Provided Methods§

Implementors§