Trait rustfst::fst_traits::ExpandedFst [−][src]
pub trait ExpandedFst<W: Semiring>: Fst<W> + Clone + PartialEq + FstIntoIterator<W> { fn num_states(&self) -> usize; fn states_range(&self) -> Range<StateId> { ... } fn approx_equal<F2: ExpandedFst<W>>(&self, fst2: &F2, delta: f32) -> bool { ... } fn quantize<F2: MutableFst<W> + AllocableFst<W>>(&self) -> Result<F2>
where
W: WeightQuantize, { ... } }
Expand description
Trait defining the necessary methods that should implement an ExpandedFST e.g a FST where all the states are already computed and not computed on the fly.
Required methods
fn num_states(&self) -> usize
fn num_states(&self) -> usize
Returns the number of states that contains the FST. They are all counted even if some states are not on a successful path (doesn’t perform triming).
Example
let mut fst = VectorFst::<BooleanWeight>::new(); assert_eq!(fst.num_states(), 0); fst.add_state(); assert_eq!(fst.num_states(), 1); fst.add_state(); assert_eq!(fst.num_states(), 2);
Provided methods
fn states_range(&self) -> Range<StateId>
fn approx_equal<F2: ExpandedFst<W>>(&self, fst2: &F2, delta: f32) -> bool
fn quantize<F2: MutableFst<W> + AllocableFst<W>>(&self) -> Result<F2> where
W: WeightQuantize,
Implementations on Foreign Types
Implementors
impl<W, F, M, B, T> ExpandedFst<W> for MatcherFst<W, F, B, M, T> where
W: Semiring,
F: ExpandedFst<W>,
B: Borrow<F> + Debug + PartialEq + Clone,
M: Debug + Clone + PartialEq,
T: Debug + Clone + PartialEq,
impl<W, F, T> ExpandedFst<W> for FstAddOn<F, T> where
W: Semiring,
F: ExpandedFst<W>,
T: Debug + Clone + PartialEq,