[][src]Function rustfst::algorithms::concat::concat

pub fn concat<W, F1, F2>(fst_1: &mut F1, fst_2: &F2) -> Result<()> where
    W: Semiring,
    F1: ExpandedFst<W> + MutableFst<W> + AllocableFst<W>,
    F2: ExpandedFst<W>, 

Performs the concatenation of two wFSTs. If A transduces string x to y with weight a and B transduces string w to v with weight b, then their concatenation transduces string xw to yv with weight a ⊗ b.

Example 1

let mut fst_a : VectorFst<IntegerWeight> = fst![2 => 3];
let fst_b : VectorFst<IntegerWeight> = fst![6 => 5];

concat(&mut fst_a, &fst_b)?;
let paths : HashSet<_> = fst_a.paths_iter().collect();

let mut paths_ref = HashSet::<FstPath<IntegerWeight>>::new();
paths_ref.insert(fst_path![2,6 => 3,5]);

assert_eq!(paths, paths_ref);

Example 2

Input Fst 1

concat_in_1

Input Fst 2

concat_in_2

Concat

concat_out