A class for finite state automata. In general, it represents
nondetermnistic finite state automata, with DFAs being a special
case.
|
|
|
|
|
generate_transitions(self)
A generator that yields each transition arrow in the FSA in the form
(source, label, target). |
source code
|
|
|
labels(self,
s1,
s2)
A generator for all possible labels taking state s1 to state s2. |
source code
|
|
|
|
|
|
|
check_in_sigma(self,
label)
Check whether a given object is in the alphabet. |
source code
|
|
|
__len__(self)
The number of states in the FSA. |
source code
|
|
int
|
|
|
|
|
|
set
|
|
list
|
|
|
add_final(self,
state)
Make a state into an accept state. |
source code
|
|
|
delete_final(self,
state)
Make an accept state no longer be an accept state. |
source code
|
|
|
set_final(self,
states)
Set the list of accept states. |
source code
|
|
|
set_start(self,
start)
Set the start state of the FSA. |
source code
|
|
|
in_finals(self,
list)
Check whether a sequence contains any final states. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
delete_state(self,
state)
Removes a state and all its transitions from the FSA. |
source code
|
|
set
|
|
|
relabel_state(self,
old,
new)
Assigns a state a new identifier. |
source code
|
|
|
next(self,
state,
symbol)
The set of states reached from a certain state via a given symbol. |
source code
|
|
|
nextStates(self,
state,
symbol)
The set of states reached from a certain state via a given symbol. |
source code
|
|
|
move(self,
states,
symbol)
The set of states reached from a set of states via a given symbol. |
source code
|
|
|
is_deterministic(self)
Return whether this is a DFA (every symbol leads from a state to at
most one target state). |
source code
|
|
|
nextState(self,
state,
symbol)
The single state reached from a state via a given symbol. |
source code
|
|
|
forward_traverse(self,
state)
All states reachable by following transitions from a given state. |
source code
|
|
|
reverse_traverse(self,
state)
All states from which a given state is reachable by following
transitions. |
source code
|
|
|
|
|
|
|
prune(self)
Modifies an FSA to remove inaccessible states and unused transitions. |
source code
|
|
|
|
|
|
set
|
e_closure(self,
states)
Given a set of states, return the set of states reachable from those
states by following epsilon transitions. |
source code
|
|
|
dfa(self)
Return a DFA that is equivalent to this FSA. |
source code
|
|
|
generate(self,
maxlen,
state=0,
prefix='
' )
Generate all accepting sequences of length at most maxlen. |
source code
|
|
|
pp(self)
Print a representation of this FSA (in human-readable YAML format). |
source code
|
|
|
|
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__
|