Package fsa_recognizer :: Module class_fsa_recognize :: Class fsa
[hide private]
[frames] | no frames]

Class fsa

source code

Known Subclasses:

Instance Methods [hide private]
 
__init__(self, transitions, finals, initial=0) source code
 
compute_alphabet(self)
Loop through states collecting all symbols with transitions defined for them.
source code
 
add_to_alphabet(self, new_symbol_set)
Union in new_symbol_set to current alphabet.
source code
 
minimize_alphabet(self)
Recompute alphabet.to be only those symbols with defined transitions.
source code
Boolean
check_finals_and_initial(self)
Return True if both initial and finals are valid states for the machine.
source code
 
add_finals(self, finals) source code
 
__repr__(self, indent=0)
Returns a string Python uses for various puproses.
source code
 
undefined_value(self) source code
Method Details [hide private]

__init__(self, transitions, finals, initial=0)
(Constructor)

source code 
Parameters:
  • transitions (list) - a list of dictionaries, one for each state
  • finals (a set of int) - a set of final states
  • initial (int) - initial state

compute_alphabet(self)

source code 

Loop through states collecting all symbols with transitions defined for them.

Update self.alphabet.

add_to_alphabet(self, new_symbol_set)

source code 

Union in new_symbol_set to current alphabet.

Parameters:
  • new_symbol_set (a set) - a set of new symbols to be added to malphabet

check_finals_and_initial(self)

source code 

Return True if both initial and finals are valid states for the machine. Else False.

Returns: Boolean

add_finals(self, finals)

source code 
Parameters:
  • finals (a set of integers) - a set of final states

__repr__(self, indent=0)
(Representation operator)

source code 

Returns a string Python uses for various puproses. For example, to print.