module Fsa:This is documentation for the command line executable "fsa".sig
..end
author: Jeff Heinz
last updated: July 30, 2006
fsa
command line executable. Usage of
this function allows one to apply a variety of operations and functions to
finite state acceptors (FSAs). With this command it is straightforward to take
unions and intersections of FSAs, to determinize, minimize, reverse FSAs,
to rename the states of an FSA and to query certain properties of FSAs. It
is also straightforward to generate words from a FSA, build prefix trees
from a finite set of words etc../fsa
or
ocamlrun fsa
at the command prompt. If you compiled using ocamlopt
then you can just type fsa
. Generally it is invoked as follows.
fsa
command is always written to standard output.
Therefore it is possible to pipe it |
to other commands or direct it >
to a file. The finite state acceptor that the fsa
command operates on
is typically identified by a filename. However, if no filename is given,
the fsa can be entered from standard input. Use ^D
to send the input to
the command.fsa
will not do anything-- the argument command
is mandatory.
The command
arguments recognized by fsa
are shown in the list below.
The command is illustrated without any flag arguments assuming that
file
contains an FSA. A brief description is also given.fsa to_dot file
converts the FSA in file
to a form that can be interpreted by AT&T's
Graphviz drawing program.fsa accepts word file
outputs "true" iff the FSA in file
accepts word
.fsa generate N M file
outputs all words between sizes N
and M
accepted by the FSA in file
.fsa merge eqr file
outputs an FSA that is the result of merging states
in blocks induced by the equivalence relation eqr
. See below.fsa make_pt file
outputs a prefix tree for the words in file
.fsa make_pt2 file
outputs a prefix tree for the words in file
.
This is faster and can handle files much larger than make_pt
fsa make_st2 file
outputs a suffix tree for the words in file
.
This is faster and can handle files much larger than make_st
fsa concat file1 file2
outputs an acceptor which accepts
the concatenation of the language accepted by the fsa in file1
and
the language accepted by the fsa in file2
.fsa inter file1 file2
outputs the intersection of the FSAs in file1
and file2
.fsa union file1 file2
outputs the union of the FSAs in file1
and file2
.fsa star file
outputs an fsa which accepts the star closure of the language
accepted by the fsa in file
.fsa reverse file
outputs the reverse of the FSA in file
fsa complement file
outputs the complement of the FSA in file
.fsa cmp_determinize
completely determinizes the complement of the FSA in file
.fsa determinize file
outputs the trimmed result of cmp_determinize
applied to the FSA in file
.fsa rename file
outputs the same FSA except the states have been
renamed with numbers, beginning with 0. If a number follows rename
then the acceptor
begin renaming with that number. E.g. fsa rename 3 file
renames the fsa in file
beginning with 3.fsa minimize file
outputs an FSA isomorphic to the canonical acceptor
for the FSA in file
.fsa trim file
outputs an FSA with no useless states otherwise identical
to the fsa in file
.fsa equal file1 file2
outputs "true" iff the FSA in file1
is exactly
identical to the FSA in file2
.fsa isomorphic file1 file2
outputs "true" iff the FSA in file1
is
isomorphic to the FSA in file2
.fsa is_cyclic file
outputs "true" iff the FSA in file1
is cyclic.fsa is_stripped file
outputs "true" iff the FSA in file1
has no
useless states.fsa is_det file
outputs "true" iff the FSA in file1
is
deterministic.fsa report file
outputs to standard output the number of start states,
final states, and the total number of states and transitions of the fsa in file
.merge
fsa merge nhoods N1 N2 file
merges states with the same N1-N2 neighborhoods.fsa merge ZR
merges states which share b-successors
(See Inference of Reversible Languages (Angluin 1982)).fsa
command, but a flag requires
less typing. These are discussed below.fsa union -rv -m -rn fsa1 fsa1
does the following:
rename(minimize(reverse(union fsa1 fsa2)))
fsa
it reads the finite state acceptor
from the input according to the specifications in this file in the current
directory. (If no file is in the directory, it uses default values.)
A FSA consists of three components:
A transition also consists of three components:
As an example, the following is a well-formed acceptor.
A! A,B,2 B,C,0 C,E,1 E,C,0 C,D,0 !B,C,D
See the file "examples/Pintupi.fsa" for more info.
fsa
reads the "dot_specs" file in the
current directory to see
how you want to the machine to appear. If there is no file named "dot_specs"
in the current directory, fsa
uses default values. There are only a few customizable
options. They are: