Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Finite Automata library

What would be the most complete finite automata library for Python, which is able to do the basic manipulations such as:

  • Minimization,
  • Determinization of Nondeterministic Finite automata
  • Union, Intersection, and Product of the languages generated by these automata, etc.

All the libraries that I'm finding are either incomplete or do not work plug-and-play-wise.

like image 763
asker Avatar asked Sep 13 '11 09:09

asker


People also ask

What is automata programming in Python?

Automata is a Python 3 library which implements the structures and algorithms for finite automata, pushdown automata, and Turing machines. The library requires Python 3.7 or newer.

How do you implement an NFA?

An nfa can be implemented by means of a recursive search from the start state for a path (directed by the symbols of the input string) to a final state. One problem with this implementation is that it could get into an infinite loop if there is a cycle of l transitions.

What is deterministic finite automata with examples?

An example of a deterministic finite automaton that accepts only binary numbers that are multiples of 3. The state S0 is both the start state and an accept state. For example, the string "1001" leads to the state sequence S0, S1, S2, S1, S0, and is hence accepted.


2 Answers

python-automata seems to be able to do all the things you're asking.

  • What is it missing?
  • Perhaps you'd want to contribute a missing feature yourself?
like image 142
Michael Foukarakis Avatar answered Oct 06 '22 18:10

Michael Foukarakis


If you don't mind using a underlying C++ library you could try OpenFst with these Python bindings. PyFsa has the optimization algoritms you listed.

like image 25
Paul Dixon Avatar answered Oct 06 '22 16:10

Paul Dixon