New port : openfst.
OpenFst is a library for constructing, combining, optimizing, and
searching weighted finite-state transducers (FSTs). Weighted finite-state
transducers are automata where each transition has an input label, an
output label, and a weight. The more familiar finite-state acceptor
is represented as a transducer with each transition's input and output
label equal. Finite-state acceptors are used to represent sets of
strings (specifically, regular or rational sets); finite-state transducers
are used to represent binary relations between pairs of strings
(specifically, rational transductions). The weights can be used to represent
the cost of taking a particular transition.