Trait 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,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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>