pythonopenfst

Showing characters instead of integers in arcs in OpenFST(PyFST)


I'm using the method linear_chain to accept a String. When I convert it into a fst binary to then into a DOT format, I get integers instead of the characters. Also, I have a SymbolTable for each of the corresponding letters being read.

What I need is to show the characters instead, be by the command line or by coding directly in Python. Any help or reference would be greatly appreciated.


Solution

  • To do this on the command line, make sure you provide both an input and output symbol table. The command should be something like

    fstdraw --isymbols=input_syms.txt --osymbols=output_syms.txt fst.bin
    

    I haven't used "PyFST", but I would suggest you use the Python bindings that are included in OpenFst 1.5.1 and later. The Python support has been getting better in versions 1.5.x, so it's best to use 1.5.3 or later.

    If using the OpenFST provided Python bindings, make sure you set the symbol tables before attempting to draw.

    fst.input_symbols = your_symbol_table
    fst.output_symbols = your_symbol_table
    fst.draw("fst.dot")
    

    There is more documentation for these Python bindings available here: http://www.openfst.org/twiki/bin/view/FST/PythonExtension

    If that doesn't help, could you post some example code please?