hfst-head

Purpose

Get N first transducers from an archive.

Usage

The help message:

Usage: hfst-head [OPTIONS...] [INFILE]
Get first transducers from an archive

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
Archive options:
  -n, --n-first=[-]K   print the first K transducers;
                       with the leading `-', print all but last K transducers

If OUTFILE or INFILE is missing or -, standard streams will be used.
Format of result depends on format of INFILE
K must be an integer, as parsed by strtoul base 10, and not 0.
If K is omitted default is 1.
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 three transducers that accept the strings "cat", "dog" and "mouse". Then we take two transducers from the beginning of the stream and print the strings that they recognize. Note that -- signifies the end of one transducer and the beginning of another one.

$ echo "cat
> dog
> mouse" | hfst-strings2fst -f foma | hfst-head -n 2 | hfst-fst2strings
cat
--
dog

See also

HfstTail

-- ErikAxelson - 09 Jul 2008