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§
sourcefn 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,
Object Safety§
This trait is not object safe.