Function rustfst::algorithms::reverse

source ·
pub fn reverse<W, F1, F2>(ifst: &F1) -> Result<F2>
Expand description

Reverse an FST.

The reversed result is written to an output mutable FST. If A transduces string x to y with weight a, then the reverse of A transduces the reverse of x to the reverse of y with weight a.Reverse().

Typically, a = a.Reverse() and a transition is its own reverse (e.g., for TropicalWeight or LogWeight). In general, e.g., when the weights only form a left or right semiring, the output transition type must match the input transition type except having the reversed Weight type.

A superinitial state is always created.

§Example

§Input

reverse_in

§Output

reverse_out