Expand description
Provides algorithms that are generic to all Fst.
Modules§
- closure
- Functions to compute Kleene closure (star or plus) of an FST.
- compose
- Functions to compose FSTs.
- concat
- Functions to concatenate FSTs.
- determinize
- Functions to determinize FSTs.
- encode
- Functions to encode FSTs as FSAs and vice versa.
- factor_
weight - Functions to factor various weight types.
- lazy
- Module providing the necessary functions to implement a new Delayed Fst.
- queues
- Module providing different structures implementing the
Queue
trait. - randgen
- Functions to randomly generate paths through an Fst. A static and a delayed version are available.
- replace
- Functions for lazy replacing transitions in an FST.
- rm_
epsilon - Functions to remove epsilon transitions from an Fst. A static and a delayed version are available.
- tr_
compares - Functions to compare / sort the Trs of an FST.
- tr_
filters - Function objects to restrict which trs are traversed in an FST.
- tr_
mappers - Module that provides structures implementing the
TrMapper
trait. - union
- Functions to compute the union of FSTs.
- weight_
converters - Module providing structures implementing the
WeightConverter
trait.
Structs§
- FinalTr
- Struct used to map final weights when performing a transition mapping.
It will always be of the form
(EPS_LABEL, EPS_LABEL, final_weight)
wherefinal_weight
is thefinal_weight
of the current state. - Isomorphic
Config - Configuration for isomorphic comparison.
- Minimize
Config - Configuration for minimization.
- Push
Config - Configuration for
push_with_config
. - Push
Type - Configuration to control the behaviour of the pushing algorithm.
- Push
Weights Config - Configuration for
push_weights_with_config
. - Shortest
Distance Config - Configuration for shortest distance computation
- Shortest
Path Config - Configuration for N-shortest path computation
Enums§
- MapFinal
Action - Determines how final weights are mapped.
- Project
Type - Different types of labels projection in a FST.
- Queue
Type - Defines the different types of Queues usable.
- Reweight
Type - Different types of reweighting.
Traits§
- Queue
- Unified interface to use different implementation of Queues.
- TrMapper
- The TrMapper interfaces defines how trs and final weights are mapped. This is useful for implementing operations that do not change the number of trs.
- Weight
Converter - The WeightConverter interfaces defines how a weight should be turned into another one. Useful for changing the semiring of an FST.
Functions§
- acceptor_
minimize - In place minimization for weighted final state acceptor.
If
allow_acyclic_minimization
is true and the input is acyclic, then a specific minimization is applied. - add_
super_ final_ state - Add, if needed, a super final state to the given FST. The super final state is returned if it is possible.
- all_
pairs_ shortest_ distance - Compute the shortest distance from each state to every other states.
The shortest distance from
p
toq
is the ⊕-sum of the weights of all the paths betweenp
andq
. - condense
- Return an acyclic FST where each SCC in the input FST has been condensed to a single state with transitions between SCCs retained and within SCCs dropped.
- connect
- Trim an Fst, removing states and trs that are not on successful paths.
- fst_
convert - Generic method to convert an Fst into any other types implementing the MutableFst trait.
- fst_
convert_ from_ ref - Generic method to convert an Fst into any other types implementing the MutableFst trait.
- invert
- Invert the transduction corresponding to an FST by exchanging the FST’s input and output labels.
- isomorphic
- Determine if two transducers with a certain required determinism have the same states, irrespective of numbering, and the same transitions with the same labels and weights, irrespective of ordering.
- isomorphic_
with_ config - Determine, with configurable comparison delta, if two transducers with a certain required determinism have the same states, irrespective of numbering, and the same transitions with the same labels and weights, irrespective of ordering.
- minimize
- In place minimization of deterministic weighted automata and transducers, and also non-deterministic ones if they use an idempotent semiring. For transducers, the algorithm produces a compact factorization of the minimal transducer.
- minimize_
with_ config - In place minimization of deterministic weighted automata and transducers, and also non-deterministic ones if they use an idempotent semiring. For transducers, the algorithm produces a compact factorization of the minimal transducer.
- optimize
- General optimization (determinization and minimization) of a WFST
- project
- This operation projects an FST onto its domain or range by either copying each transition input label to its output label or vice versa.
- push
- Push the weights and/or labels of the input FST into the output mutable FST by pushing weights and/or labels towards the initial state or final states.
- push_
weights - Push the weights in an FST.
- push_
weights_ with_ config - Push the weights in an FST, optionally removing the total weight.
- push_
with_ config - Push the weights and/or labels of the input FST into the output mutable FST by pushing weights and/or labels towards the initial state or final states.
- relabel_
pairs - Replace input and/or output labels using pairs of labels.
- reverse
- Reverse an FST.
- reweight
- Reweight an FST according to a vector of potentials in a given direction.
- rm_
final_ epsilon - Removes final states that have epsilon-only input trs.
- shortest_
distance - Compute the shortest distance from the initial state to every state.
The shortest distance from
p
toq
is the ⊕-sum of the weights of all the paths betweenp
andq
. - shortest_
distance_ with_ config - Compute the shortest distance from the initial state to every state, with configurable delta for comparison.
- shortest_
path - Create an FST containing the single shortest path in the input FST. The shortest path is the lowest weight paths w.r.t. the natural semiring order.
- shortest_
path_ with_ config - Create an FST containing the n-shortest paths in the input FST. The n-shortest paths are the n-lowest weight paths w.r.t. the natural semiring order.
- state_
sort - Sort the input states of an FST.
- top_
sort - Topologically sort an FST. When sorted, all transitions are from lower to higher state IDs.
- tr_map
- Maps every transition in the FST using an
TrMapper
object. - tr_sort
- Sorts trs leaving each state of the FST using a compare function
- tr_sum
- Plus-Sum weights of trs leaving the same state, going to the same state and with the same input and output labels.
- tr_
unique - Keep a single instance of trs leaving the same state, going to the same state and with the same input labels, output labels and weight.
- weight_
convert - Convert an FST in a given Semiring to another Semiring using a WeightConverter to specify how the conversion should be performed.