Package fsa_recognizer :: Module read_fst_file :: Class XfstCompiler
[hide private]
[frames] | no frames]

Class XfstCompiler

source code

 object --+    
          |    
FstCompiler --+
              |
             XfstCompiler

Code for compiling an Xerox xfst representation of an FST into a Python FST rep.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
initialize_reader(self)
This function zeroes out all the records kept during the reading of a fst file so that the same compiler can be used on a new file safely.
source code
dictionary of dictionary of dictionaries
read_file(self, file)
Open xerox ".net" file file and return raw_dic, a dictionary representation of the FST represented there.
source code
 
process_state(self, state) source code
 
cmp_item(self, item1, item2) source code
a set of pairs of word and state.
process_transitions(self, state, transitions)
transitions a string of comma separated state transitions of the form:
source code
 
classify_links(self, node_dic)
Add info to node dic for state and self.transition_pairs[state]
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

initialize_reader(self)

source code 

This function zeroes out all the records kept during the reading of a fst file so that the same compiler can be used on a new file safely. Shd be called by read_file.

Overrides: FstCompiler.initialize_reader

read_file(self, file)

source code 

Open xerox ".net" file file and return raw_dic, a dictionary representation of the FST represented there.

We retain the state names in the net file, which determine which is a start state ('s0') and which are final states (state names beginning with 'fs'.

See interface documentation for Class FstCompiler method read_file. This method respects that interface.

Parameters:
  • file - file containing xfst representation of an FST.
Returns: dictionary of dictionary of dictionaries
Overrides: FstCompiler.read_file

process_transitions(self, state, transitions)

source code 

transitions a string of comma separated state transitions of the form:

 word -> state
Returns: a set of pairs of word and state.

classify_links(self, node_dic)

source code 

Add info to node dic for state and self.transition_pairs[state]

This is called after all state declarations have been read in and a name mapping assigned in self.name_mapping.

Parameters:
  • node_dic - the dictionary representation of the FST to be updated