[][src]Function rustfst::algorithms::compose::compose

pub fn compose<W: Semiring, F1: ExpandedFst<W>, F2: ExpandedFst<W>, F3: MutableFst<W> + AllocableFst<W>>(
    fst1: Arc<F1>,
    fst2: Arc<F2>
) -> Result<F3>

This operation computes the composition of two transducers. If A transduces string x to y with weight a and B transduces y to z with weight b, then their composition transduces string x to z with weight a ⊗ b.

Example

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

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

let fst_ref : VectorFst<IntegerWeight> = fst![1,2 => 3,4];

let composed_fst : VectorFst<_> = compose(Arc::new(fst_1), Arc::new(fst_2))?;
assert_eq!(composed_fst, fst_ref);