MOAL.automata_theory.finite_state_machine package

Submodules

MOAL.automata_theory.finite_state_machine.fsm module

class MOAL.automata_theory.finite_state_machine.fsm.Acceptor(states={}, default=None, debug=False, max=20)[source]

Bases: MOAL.automata_theory.finite_state_machine.fsm.FiniteStateMachine

test(string)
class MOAL.automata_theory.finite_state_machine.fsm.Classifier(states={}, default=None, debug=False, max=20)[source]

Bases: MOAL.automata_theory.finite_state_machine.fsm.Acceptor

From Wikipedia: “Classifier is a generalization that, similar to acceptor, produces single output when terminates but has more than two terminal states.”

classify(*args, **kwargs)[source]
class MOAL.automata_theory.finite_state_machine.fsm.FiniteStateMachine(states={}, default=None, debug=False, max=20)[source]

Bases: object

__delitem__(state)
__getitem__(state)
__init__(states={}, default=None, debug=False, max=20)
__setitem__(state, data)
__str__()
_get_current()
_get_transition(edge)
_print(edge, old, new)
_set_current(node_label)
_xform(edge)

Allows customization of coercion function, for the transition key type, and/or index naming convention - some require ints, some strings, multiple nested indices, etc... This removes the requirement to override _get_transition with a lot more code.

get_next_value(node, edge)
reset()
transition(edge)
class MOAL.automata_theory.finite_state_machine.fsm.InvalidTransition[source]

MOAL.automata_theory.finite_state_machine.markov_chain module

MOAL.automata_theory.finite_state_machine.recognizer module

class MOAL.automata_theory.finite_state_machine.recognizer.Recognizer(states={}, default=None, debug=False, max=20)[source]

Bases: MOAL.automata_theory.finite_state_machine.fsm.Acceptor

_xform(edge)
recognize(digits)
class MOAL.automata_theory.finite_state_machine.recognizer.RegularExpression(states={}, default=None, debug=False, max=20)[source]

Bases: MOAL.automata_theory.finite_state_machine.recognizer.Recognizer

MOAL.automata_theory.finite_state_machine.transducer module

class MOAL.automata_theory.finite_state_machine.transducer.ControlApplicationTransducer(*args, **kwargs)[source]

Bases: MOAL.automata_theory.finite_state_machine.transducer.Transducer

class MOAL.automata_theory.finite_state_machine.transducer.MealyMachine(*args, **kwargs)[source]

Bases: MOAL.automata_theory.finite_state_machine.transducer.ControlApplicationTransducer

class MOAL.automata_theory.finite_state_machine.transducer.MooreMachine(*args, **kwargs)[source]

Bases: MOAL.automata_theory.finite_state_machine.transducer.ControlApplicationTransducer

run(**kwargs)

Moore Machines signal to the outside world (or other FSMs) the current state of the machine (based on the last run transition path, in this case.)

class MOAL.automata_theory.finite_state_machine.transducer.RichardsController(*args, **kwargs)[source]

Bases: MOAL.automata_theory.finite_state_machine.transducer.MealyMachine

From Wikipedia: “Each state is represented as a transfer condition on the flowchart. Each condition has two control paths leading out of it, a YES or a NO.”

__setitem__(state, data)[source]
class MOAL.automata_theory.finite_state_machine.transducer.Sequencer(*args, **kwargs)[source]

Bases: MOAL.automata_theory.finite_state_machine.transducer.Transducer

From Wikipedia: “The sequencers or generators are a subclass of aforementioned types that have a single-letter input alphabet. They produce only one sequence, which can be interpreted as output sequence of transducer or classifier outputs.”

e.g. Seq-0 = S1 -> S2, Seq-1 = S2 -> S3, Seq-N = SN -> SN + 1, etc...

__init__(*args, **kwargs)[source]
__setitem__(node, data)[source]
_check_valid_sequence(node, data)[source]
class MOAL.automata_theory.finite_state_machine.transducer.SequencerAlphabetError[source]
class MOAL.automata_theory.finite_state_machine.transducer.Transducer(*args, **kwargs)[source]

Bases: MOAL.automata_theory.finite_state_machine.fsm.FiniteStateMachine

__init__(*args, **kwargs)
_run(node=None, edge=None)
run(**kwargs)
run_all()
MOAL.automata_theory.finite_state_machine.transducer.generate_transducer(nodes=10, alphabet=None)[source]
MOAL.automata_theory.finite_state_machine.transducer.run_random_transducer(**kwargs)[source]