Skip to content

HfstFst2Txt

eaxelson edited this page Nov 24, 2017 · 2 revisions

hfst-fst2txt

Purpose

Print transducer in AT&T tabular format.

Usage

The help message:

Usage: hfst-fst2txt [OPTIONS...] [INFILE]
Print transducer in AT&T, dot, prolog or pckimmo format

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:
  -i, --input=INFILE     Read input transducer from INFILE
  -o, --output=OUTFILE   Write output transducer to OUTFILE
Text format options:
  -w, --print-weights          If weights are printed in all cases
  -D, --do-not-print-weights   If weights are not printed in any case
  -f, --format=TFMT            Print output in TFMT format [default=att]

If OUTFILE or INFILE is missing or -, standard streams will be used.
Unless explicitly requested with option -w or -D, weights are printed
if and only if the transducer is in weighted format.
TFMT is one of {att, dot, prolog, pckimmo}.

Report bugs to <hfst-bugs@helsinki.fi> or directly to our bug tracker at:
<https://sourceforge.net/tracker/?atid=1061990&group_id=224521&func=browse>

Examples

Print tabular representation of cat.hfst:

hfst-fst2txt cat.hfst

The output:

0    1    c    c    0.0
1    2    a    a    0.0
2    3    t    t    0.0
3    0.0

Output formatting

The output format for this tool is same as in OpenFst tools; tab separated values where lines of 2 fields are used to represent final state number and its weight, and lines of 5 fields are used to represent transitions from state number to state number with given input symbol, output symbol and weight. The state number is integer whose range depends on underlying backend used. The symbols are strings. The weight is a float formatted by printf(3) operator %d, and optional. The output format can be toggled with -w and -D

       hfst-fst2xt -w cat.hfst
              prints fifth and second columns even if cat.hfst is unweighted

       hfst-fst2txt -D cat.hfst
              prints single and four-column format even if cat.hfst  has  non-
              zero weights

Output

Special symbols are printed as follows:

symbol print form note
epsilon @0@
space @_SPACE_@ an unescaped space is a field delimiter
tabulator @_TAB_@ an unescaped tabulator is a field delimiter

See also

hfst-txt2fst

Clone this wiki locally