Trait rustfst::fst_traits::ExpandedFst

source ·
pub trait ExpandedFst<W: Semiring>: Fst<W> + Clone + PartialEq + FstIntoIterator<W> {
    // Required method
    fn num_states(&self) -> usize;

    // 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 { ... }
}
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§

source

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§

source

fn states_range(&self) -> Range<StateId>

source

fn approx_equal<F2: ExpandedFst<W>>(&self, fst2: &F2, delta: f32) -> bool

source

fn quantize<F2: MutableFst<W> + AllocableFst<W>>(&self) -> Result<F2>
where W: WeightQuantize,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<W: Semiring, F: ExpandedFst<W>> ExpandedFst<W> for Arc<F>

Implementors§

source§

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,

source§

impl<W, F, T> ExpandedFst<W> for FstAddOn<F, T>
where W: Semiring, F: ExpandedFst<W>, T: Debug + Clone + PartialEq,

source§

impl<W: 'static + Semiring> ExpandedFst<W> for ConstFst<W>

source§

impl<W: 'static + Semiring> ExpandedFst<W> for VectorFst<W>