fst2dot Finite State Transducer Visualizer

fst2dot translates SFST transducers to Graphviz dot files.


fst2dot is a filter script that allows to visualize transducers generated by SFST using Graphviz. It is written in Perl and easy to use.

Especially sfst beginners may consider fst2dot useful in order to get a quick overview on what their transducers look like.

Usage Example

fst2dot takes fst-print's output and generates a graphviz dot-file from that input. Graphivz can than produce a pritty graph of your automata.

Here's a complete example:

$TEST$ = Dach | Fach | Bach | dich | mich | sich


Now, compile the transducer and feed the output of fst-print to

$ fst-compiler test.fst test.a
test.fst: 4

$ fst-print test.a | perl - >

The resulting dot file looks like this:

# automatically generated by fst2dot v0.2

digraph agraph
    node [shape="circle", label=""];

    0 -> 1 [label="B"];
    0 -> 1 [label="D"];
    0 -> 1 [label="F"];
    0 -> 5 [label="d"];
    0 -> 5 [label="m"];
    0 -> 5 [label="s"];
    1 -> 2 [label="a"];
    2 -> 3 [label="c"];
    3 -> 4 [label="h"];
    4 [shape="doublecircle"]
    5 -> 2 [label="i"];

Graphviz can now use "" as an input to produce a fancy graph:

$ dot -Tpng -o test.png

As a shortcut, the last steps may be combined using pipes:

$ fst-print test.a | fst2dot - | dot -Tpng -o test.png

Please note that in the above example has been renamed to fst2dot, given execute permissions ("chmod a+x fst2dot") and placed in a directory listed in $PATH.


Download & License

The current version of fst2dot (0.2) is suitable for SFST version >= 1.3 and can be downloaded here:

The 0.1 version, which is suitable for SFST versions below 1.3, is still available here:

fst2dot is available under the terms of the MIT license.


Please note: fst2dot doesn't work with the Xerox Finite State Tools

A similar script which is used in the same way is available for download, too: Anyway, I haven't used it for a long time, because I don't use xfst anymore, so you're on your own with this one.