pub struct FactorWeightFst<W: WeightQuantize, F: Fst<W>, B: Borrow<F>, FI: FactorIterator<W>>(/* private fields */);Expand description
The result of weight factoring is a transducer equivalent to the input whose path weights have been factored according to the FactorIterator. States and transitions will be added as necessary. The algorithm is a generalization to arbitrary weights of the second step of the input epsilon-normalization algorithm. This version is a Delayed FST.
Implementations§
Source§impl<W, F: Fst<W>, B: Borrow<F>, FI: FactorIterator<W>> FactorWeightFst<W, F, B, FI>where
W: WeightQuantize,
impl<W, F: Fst<W>, B: Borrow<F>, FI: FactorIterator<W>> FactorWeightFst<W, F, B, FI>where
W: WeightQuantize,
pub fn new(fst: B, opts: FactorWeightOptions) -> Result<Self>
Sourcepub fn compute<F2: MutableFst<W> + AllocableFst<W>>(&self) -> Result<F2>
pub fn compute<F2: MutableFst<W> + AllocableFst<W>>(&self) -> Result<F2>
Turns the Lazy FST into a static one.
Trait Implementations§
Source§impl<W, F, B, FI> CoreFst<W> for FactorWeightFst<W, F, B, FI>
impl<W, F, B, FI> CoreFst<W> for FactorWeightFst<W, F, B, FI>
Source§fn start(&self) -> Option<StateId>
fn start(&self) -> Option<StateId>
Returns the ID of the start state of the wFST if it exists else none. Read more
Source§fn final_weight(&self, state_id: StateId) -> Result<Option<W>>
fn final_weight(&self, state_id: StateId) -> Result<Option<W>>
Retrieves the final weight of a state (if the state is a final one). Read more
Source§unsafe fn final_weight_unchecked(&self, state_id: StateId) -> Option<W>
unsafe fn final_weight_unchecked(&self, state_id: StateId) -> Option<W>
Retrieves the final weight of a state (if the state is a final one). Read more
Source§fn num_trs(&self, s: StateId) -> Result<usize>
fn num_trs(&self, s: StateId) -> Result<usize>
Number of trs leaving a specific state in the wFST. Read more
Source§unsafe fn num_trs_unchecked(&self, s: StateId) -> usize
unsafe fn num_trs_unchecked(&self, s: StateId) -> usize
Number of trs leaving a specific state in the wFST. Read more
Source§fn get_trs(&self, state_id: StateId) -> Result<Self::TRS>
fn get_trs(&self, state_id: StateId) -> Result<Self::TRS>
Get an iterator on the transitions leaving state
state.Source§unsafe fn get_trs_unchecked(&self, state_id: StateId) -> Self::TRS
unsafe fn get_trs_unchecked(&self, state_id: StateId) -> Self::TRS
Get an iterator on the transitions leaving state
state. Read moreSource§fn properties(&self) -> FstProperties
fn properties(&self) -> FstProperties
Retrieve the
FstProperties stored in the Fst. As a result, all the properties returned
are verified by the Fst but some other properties might be true as well despite the flag
not being set.Source§fn num_input_epsilons(&self, state: StateId) -> Result<usize>
fn num_input_epsilons(&self, state: StateId) -> Result<usize>
Returns the number of trs with epsilon input labels leaving a state. Read more
Source§fn num_output_epsilons(&self, state: StateId) -> Result<usize>
fn num_output_epsilons(&self, state: StateId) -> Result<usize>
Returns the number of trs with epsilon output labels leaving a state. Read more
Source§fn is_final(&self, state_id: StateId) -> Result<bool>
fn is_final(&self, state_id: StateId) -> Result<bool>
Returns whether or not the state with identifier passed as parameters is a final state. Read more
Source§unsafe fn is_final_unchecked(&self, state: StateId) -> bool
unsafe fn is_final_unchecked(&self, state: StateId) -> bool
Returns whether or not the state with identifier passed as parameters is a final state. Read more
Source§fn is_start(&self, state_id: StateId) -> bool
fn is_start(&self, state_id: StateId) -> bool
Check whether a state is the start state or not.
Source§fn properties_with_mask(&self, mask: FstProperties) -> FstProperties
fn properties_with_mask(&self, mask: FstProperties) -> FstProperties
Apply a mask to the
FstProperties returned.Source§fn properties_check(&self, props_known: FstProperties) -> Result<FstProperties>
fn properties_check(&self, props_known: FstProperties) -> Result<FstProperties>
Retrieve the
FstProperties in the Fst and check that all the
properties in props_known are known (not the same as true). If not an error is returned. Read moreSource§impl<W, F, B, FI> Debug for FactorWeightFst<W, F, B, FI>
impl<W, F, B, FI> Debug for FactorWeightFst<W, F, B, FI>
Source§impl<W, F, B, FI> Fst<W> for FactorWeightFst<W, F, B, FI>where
W: WeightQuantize,
F: Fst<W> + 'static,
B: Borrow<F> + 'static,
FI: FactorIterator<W> + 'static,
impl<W, F, B, FI> Fst<W> for FactorWeightFst<W, F, B, FI>where
W: WeightQuantize,
F: Fst<W> + 'static,
B: Borrow<F> + 'static,
FI: FactorIterator<W> + 'static,
Source§fn input_symbols(&self) -> Option<&Arc<SymbolTable>>
fn input_symbols(&self) -> Option<&Arc<SymbolTable>>
Retrieves the input
SymbolTable associated to the Fst.
If no SymbolTable has been previously attached then None is returned.Source§fn output_symbols(&self) -> Option<&Arc<SymbolTable>>
fn output_symbols(&self) -> Option<&Arc<SymbolTable>>
Retrieves the output
SymbolTable associated to the Fst.
If no SymbolTable has been previously attached then None is returned.Source§fn set_input_symbols(&mut self, symt: Arc<SymbolTable>)
fn set_input_symbols(&mut self, symt: Arc<SymbolTable>)
Attaches an output
SymbolTable to the Fst.
The SymbolTable is not duplicated with the use of Arc.Source§fn set_output_symbols(&mut self, symt: Arc<SymbolTable>)
fn set_output_symbols(&mut self, symt: Arc<SymbolTable>)
Attaches an output
SymbolTable to the Fst.
The SymbolTable is not duplicated with the use of Arc.Source§fn take_input_symbols(&mut self) -> Option<Arc<SymbolTable>>
fn take_input_symbols(&mut self) -> Option<Arc<SymbolTable>>
Removes the input symbol table from the Fst and retrieves it.
Source§fn take_output_symbols(&mut self) -> Option<Arc<SymbolTable>>
fn take_output_symbols(&mut self) -> Option<Arc<SymbolTable>>
Removes the output symbol table from the Fst and retrieves it.
Source§fn final_states_iter(&self) -> FinalStatesIterator<'_, W, Self>where
Self: Sized,
fn final_states_iter(&self) -> FinalStatesIterator<'_, W, Self>where
Self: Sized,
Returns an Iterator on the final states along with their weight.
Source§fn paths_iter(&self) -> PathsIterator<'_, W, Self> ⓘwhere
Self: Sized,
fn paths_iter(&self) -> PathsIterator<'_, W, Self> ⓘwhere
Self: Sized,
Returns an Iterator on the paths accepted by the Fst. Read more
Source§fn string_paths_iter(&self) -> Result<StringPathsIterator<'_, W, Self>>where
Self: Sized,
fn string_paths_iter(&self) -> Result<StringPathsIterator<'_, W, Self>>where
Self: Sized,
Returns an Iterator on the paths accepted by the Fst. Plus, handles the SymbolTable
allowing to retrieve the strings instead of only the sequence of labels. Read more
Source§impl<'a, W, F, B, FI> FstIterator<'a, W> for FactorWeightFst<W, F, B, FI>
impl<'a, W, F, B, FI> FstIterator<'a, W> for FactorWeightFst<W, F, B, FI>
Source§impl<'a, W, F, B, FI> StateIterator<'a> for FactorWeightFst<W, F, B, FI>
impl<'a, W, F, B, FI> StateIterator<'a> for FactorWeightFst<W, F, B, FI>
Source§type Iter = <LazyFst<W, FactorWeightOp<W, F, B, FI>, SimpleHashMapCache<W>> as StateIterator<'a>>::Iter
type Iter = <LazyFst<W, FactorWeightOp<W, F, B, FI>, SimpleHashMapCache<W>> as StateIterator<'a>>::Iter
Iterator used to iterate over the
state_id of the states of an FST.Source§fn states_iter(&'a self) -> Self::Iter
fn states_iter(&'a self) -> Self::Iter
Creates an iterator over the
state_id of the states of an FST. Read moreAuto Trait Implementations§
impl<W, F, B, FI> !Freeze for FactorWeightFst<W, F, B, FI>
impl<W, F, B, FI> RefUnwindSafe for FactorWeightFst<W, F, B, FI>
impl<W, F, B, FI> Send for FactorWeightFst<W, F, B, FI>
impl<W, F, B, FI> Sync for FactorWeightFst<W, F, B, FI>
impl<W, F, B, FI> Unpin for FactorWeightFst<W, F, B, FI>
impl<W, F, B, FI> UnwindSafe for FactorWeightFst<W, F, B, FI>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more