Package nltk_lite :: Package contrib :: Package fst :: Module fst :: Class FSMTools
[hide private]
[frames] | no frames]

Class FSMTools

source code

A class used to interface with the AT&T fsmtools package. In particular, FSMTools.transduce can be used to transduce an input string using any subsequential transducer where each input and output arc is labelled with at most one symbol.

Nested Classes [hide private]
    Helpers
  IDMapping
Instance Methods [hide private]
 
__init__(self, fsmtools_path='') source code
    Transduction
 
transduce(self, fst, input_string) source code
    FSM Compilation
 
compile_fst(self, fst, outfile)
Compile the given FST to an fsmtools .fsm file, and write it to the given filename.
source code
 
compile_string(self, sym_string, outfile)
Compile the given symbol string into an fsmtools .fsm file, and write it to the given filename.
source code
    Helpers
 
_bin(self, command) source code
 
_string_id(self, sym_string) source code
Class Variables [hide private]
  EPSILON = object()
A special symbol object used to represent epsilon strings in the symbol<->id mapping (FSMTools._symbol_ids).
Instance Variables [hide private]
  fsmtools_path
The path of the directory containing the fsmtools binaries.
  _symbol_ids
A mapping from symbols to unique integer IDs.
  _state_ids
A mapping from state labels to unique integer IDs.
Method Details [hide private]

compile_string(self, sym_string, outfile)

source code 

Compile the given symbol string into an fsmtools .fsm file, and write it to the given filename. This FSM will generate the given symbol string, and no other strings.


Instance Variable Details [hide private]

_symbol_ids

A mapping from symbols to unique integer IDs. We manage our own mapping, rather than using 'symbol files', since symbol files can't handle non-string symbols, symbols containing whitespace, unicode symbols, etc.