Skip to content

emersonn/machination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

machination BuildStatus

A finite state machine modeler that allows you to generate output for procedures such as text generation.

Installation

Install using the provided setup.py.

$ cd path/to/main/folder
$ pip install .

Basic Usage

  1. Create a list of States that you will use in your Machination. All your States should be uniquely named. Return None if your State has no State to go to, or if there is a condition that cannot be satisfied.
from machination.stringbuild import StringState
st_one = StringState("one_name", one_function, "one text")
  1. Create a Machination from the List of States, along with the starting State.
from machination.stringbuild import StringMachination
mach = StringMachination(states, st_one)
  1. Run the Machination on given data. Here we are running it on a single piece of data where the 'one_name' state gets the argument of 'cats.' An optional argument was passed where if we were to visit another state, we would concatenate the strings with a space instead of nothing at all.
mach.run({
  'one_name': 'cats'
}, " ")

Testing

Testing requires mock, nose and (optional) coverage libraries. nosetests should work just fine.

About

Finite state machine modeller

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages