hfst-push-weights

Purpose

Push weights of a transducer towards initial state or final states.

Usage

The help message:

Usage: hfst-push-weights [OPTIONS...] [INFILE]
Push weights of transducer

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
Push options:
  -p, --push=DIRECTION   push to DIRECTION

If OUTFILE or INFILE is missing or -, standard streams will be used.
Format of result depends on format of INFILE
DIRECTION must be one of start, initial, begin or end, final

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

We create a simple transducer with consecutive transitions a:a with no weight and b:b with weight 3. These transitions lead to a final state that has weight 5. This transducer accepts the string "ab" with a weight of 3 + 5 = 8:

$ echo "0 1 a a
> 1 2 b b 3
> 2 5" | hfst-txt2fst -f openfst-tropical > ab.hfst
$ hfst-fst2txt ab.hfst
0       1       a       a       0.000000
1       2       b       b       3.000000
2       5.000000

If we push the weights of the transducer towards the initial state, the weight is moved to the first transition:

$ hfst-push-weights --push=initial ab.hfst | hfst-fst2txt
0       1       a       a       8.000000
1       2       b       b       0.000000
2       0.000000

If we push the weights towards the final state, the weight is moved to the final state:

$ hfst-push-weights --push=final ab.hfst | hfst-fst2txt
0       1       a       a       0.000000
1       2       b       b       0.000000
2       8.000000

-- ErikAxelson - 09 Jul 2008