nlpstack.common.automaton module#
- class nlpstack.common.automaton.DFA(state)[source]#
Bases:
Generic[Symbol]A deterministic finite automaton (DFA)
- Parameters:
state (DFAState) –
- class nlpstack.common.automaton.DFAState(is_final=False, transition=<factory>)[source]#
Bases:
Generic[Symbol]- Parameters:
is_final (bool) –
transition (Dict[Symbol, DFAState]) –
- acceptable_symbols()[source]#
Return acceptable symbols for this state.
- Return type:
Set[TypeVar(Symbol, bound=Hashable)]
-
is_final:
bool= False#
- class nlpstack.common.automaton.NFA(start, end)[source]#
Bases:
Generic[Symbol]A nondeterministic finite automaton (NFA)
- closure()[source]#
Create an NFA that accepts the closure of the language of an NFA.
- Return type:
NFA[TypeVar(Symbol, bound=Hashable)]
- classmethod from_epsilon()[source]#
Create an NFA that accepts an empty string.
- Return type:
NFA[TypeVar(Symbol, bound=Hashable)]
- class nlpstack.common.automaton.NFAState(is_final=False, transition=<factory>, epsilon_transitions=<factory>)[source]#
Bases:
Generic[Symbol]- Parameters:
- allowed_transitions()[source]#
Return allowed transitions for this state.
- Return type:
Dict[TypeVar(Symbol, bound=Hashable),Set[NFAState]]
-
is_final:
bool= False#