connect

Function connect 

Source
pub fn connect<W: Semiring, F: ExpandedFst<W> + MutableFst<W>>(
    fst: &mut F,
) -> Result<()>
Expand description

Trim an Fst, removing states and trs that are not on successful paths.

§Example 1

let fst : VectorFst<IntegerWeight> = fst![2 => 3];

// Add a state not on a successful path
let mut no_connected_fst = fst.clone();
no_connected_fst.add_state();

let mut connected_fst = no_connected_fst.clone();
connect(&mut connected_fst)?;

assert_eq!(connected_fst, fst);

§Example 2

§Input

connect_in

§Connect

connect_out