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
.
The output labels of the first transducer or the input labels of the second transducer must be sorted (or the FSTs otherwise support appropriate
matchers).
The weights need to form a commutative semiring (valid for TropicalWeight
and LogWeight
for instance).
Versions of this operation (not all shown here) accept options that allow choosing the matcher, composition filter, state table and, when delayed, the caching behavior used by composition.
template <class Arc> void Compose(const Fst<Arc> &ifst1, const Fst<Arc> &ifst2, MutableFst<Arc> *ofst); 

template <class Arc> ComposeFst<Arc>:: ComposeFst(const Fst<Arc> &fst1, const Fst<Arc> &fst2); 
%DOX{fst::ComposeFst[]}% 
fstcompose [opts] a.fst b.fst out.fst connect: Trim output (def: true) 
A
:
B
:
A o B
:
Compose(A, B, &C); ComposeFst<Arc>(A, B); fstcompose a.fst b.fst out.fst
Assuming the first FST is unsorted and the second is sorted:
Compose
:
ComposeFst
:
Compose
and fstcompose
trim their output, ComposeFst
does not (since it is a delayed operation).
The efficiency of composition can be strongly affected by several factors:
See here for more discussion on efficient usage.
I  Attachment  History  Action  Size  Date  Who  Comment 

jpg  compose2.jpg  r7 r6 r5 r4 r3  manage  11.2 K  20070630  21:47  MichaelRiley  
jpg  compose1.jpg  r2 r1  manage  11.7 K  20070630  21:47  MichaelRiley  
jpg  compose3.jpg  r6 r5 r4 r3 r2  manage  14.8 K  20070630  21:47  MichaelRiley 