HFST: The Yale Shooting Problem

We examplify the use of HFST command line tools with an example taken from Beesley & Karttunen. $FORMAT is the implementation type of the transducer. The solution given on this page can also be executed with a single script. For more information on the background of this problem, see the original script

Some definitions:

echo 'load | loaded | shoot | alive' | hfst-regexp2fst -f $FORMAT > Proposition 
echo '[%+ | %- | F] @"Proposition" ' | hfst-regexp2fst -f $FORMAT > Valuation 
echo '%[ (@"Valuation" [%, @"Valuation"]*) %]' | hfst-regexp2fst -f $FORMAT \
> Frame 

A few auxiliary definitions.

echo '@"Frame" & $[%+ loaded] & ~$[%- loaded]' | hfst-regexp2fst -f $FORMAT \
  > Loaded 
echo '@"Frame" & $[%+ load] & ~$[%- load]' | hfst-regexp2fst -f $FORMAT > Load 
echo '@"Frame" & $[%+ shoot] & ~$[%- shoot]' | hfst-regexp2fst -f $FORMAT \
> Shoot 
echo '@"Frame" & $[%+ alive] & ~$[%- alive]' | hfst-regexp2fst -f $FORMAT \
> Alive 
echo '@"Frame" & $[F loaded]' | hfst-regexp2fst -f $FORMAT > FLoaded 
echo '@"Frame" & $[F alive]' | hfst-regexp2fst -f $FORMAT > FAlive 

The Inertia constraints on adjacent frames can be stated as follows. We start with loaded.

echo '[@"Loaded" & ~@"FLoaded" => _ @"Loaded" | .#.]
                   &
      [@"Loaded" => .#. | @"Loaded" | @"FLoaded" _ ]' | \
hfst-regexp2fst -f $FORMAT > InertLoaded;

The inertness constraint on alive has the same form:

echo '[@"Alive" & ~@"FAlive" => _ @"Alive" | .#.]
                   &
      [@"Alive" => .#. | @"Alive" | @"FAlive" _ ]' | \
hfst-regexp2fst -f $FORMAT > InertAlive

More constraints:

echo '~[@"Load" & ~@"FLoaded"]' | hfst-regexp2fst -f $FORMAT > LoadFLoaded 

echo '~[@"Shoot" & ~@"FAlive"]' | hfst-regexp2fst -f $FORMAT > ShootFAlive 

echo '~[@"Shoot" & ~@"FLoaded"]' | hfst-regexp2fst -f $FORMAT > ShootFLoaded 

We continue:

echo '[@"Alive" & ~@"Loaded"] @"Load" @"Frame"* @"Shoot" @"Frame"' | \
  hfst-regexp2fst -f $FORMAT > YaleShooting 

echo '@"YaleShooting" & @"InertLoaded" & @"InertAlive" & @"LoadFLoaded" & 
      @"ShootFAlive" & @"ShootFLoaded"' | hfst-regexp2fst -f $FORMAT \
> YaleShooting.hfst.hfst


-- ErikAxelson - 2011-09-27