Utility for finite-state automaton