Trait rustfst::Semiring [−][src]
pub trait Semiring: Clone + PartialEq + PartialOrd + Debug + Hash + Eq + Sync + 'static { type Type: Clone + Debug; type ReverseWeight: Semiring + ReverseBack<Self>;}Show 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
For some operations, the weight set associated to a wFST 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
Associated Types
type ReverseWeight: Semiring + ReverseBack<Self>
Required methods
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 take_value(self) -> Self::Type
fn take_value(self) -> Self::Type
Move underneath value.
fn reverse(&self) -> Result<Self::ReverseWeight>
fn properties() -> SemiringProperties