Function rustfst::algorithms::reverse[][src]

pub fn reverse<W, F1, F2>(ifst: &F1) -> Result<F2> where
    W: Semiring,
    F1: ExpandedFst<W>,
    F2: MutableFst<W::ReverseWeight> + AllocableFst<W::ReverseWeight>, 
Expand description

Reverses 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