Compose two transducers.


The help message:

Usage: hfst-compose [OPTIONS...] [INFILE1 [INFILE2]]
Compose two transducers

Common options:
  -h, --help             Print help message
  -V, --version          Print version info
  -v, --verbose          Print verbosely while processing
  -q, --quiet            Only print fatal erros and requested output
  -s, --silent           Alias of --quiet
Input/Output options:
  -1, --input1=INFILE1   Read first input transducer from INFILE1
  -2, --input2=INFILE2   Read second input transducer from INFILE2
  -C, --do-not-convert   Do not allow transducers to be converted into the same type
  -o, --output=OUTFILE   Write results to OUTFILE
Composition options:
  -x, --xerox-composition=VALUE Whether flag diacritics are treated as ordinary
                                symbols in composition (default is false).
  -X, --xfst=VARIABLE    Toggle xfst compatibility option VARIABLE.
  -H, --do-not-harmonize Do not harmonize symbols.
  -F, --harmonize-flags  Harmonize flag diacritics.

If OUTFILE, or either INFILE1 or INFILE2 is missing or -,
standard streams will be used.
INFILE1, INFILE2, or both, must be specified.
Format of result depends on format of INFILE1 and INFILE2;
both should have the same format.

The operation is applied pairwise for INFILE1 and INFILE2
that must have the same number of transducers.
If INFILE2 has only one transducer, the operation is applied for
each transducer in INFILE1 keeping the second transducer constant.

Xfst variables are {flag-is-epsilon (default OFF)}.
VALUE can be one of the following: [true|false], [yes|no] or [ON|OFF],
false being the default.

  hfst-compose -o cat2dog.hfst cat2mouse.hfst mouse2dog.hfst  composes two automata

Report bugs to <hfst-bugs@helsinki.fi> or directly to our bug tracker at:


We create a transducer cat2chat.hfst that maps "cat" to "chat". Then we create a transducer that maps "chat" to "gato" and compose cat2chat.hfst with it. We then print the string pair that the composed transducer recognizes. The commands below:

echo "cat:chat" | hfst-strings2fst -f foma > cat2chat.hfst
echo "chat:gato" | hfst-strings2fst -f foma | hfst-compose -1 cat2chat.hfst > cat2gato.hfst
hfst-fst2strings cat2gato.hfst

will print to the standard output:


See also


-- ErikAxelson - 09 Jul 2008