Some performance improvements in the FA generation.

This commit is contained in:
bringert
2005-12-22 23:16:15 +00:00
parent 29ba681242
commit e32472a9bb
6 changed files with 92 additions and 53 deletions

View File

@@ -16,7 +16,8 @@ module GF.Speech.FiniteState (FA, State, NFA, DFA,
states, transitions,
newFA,
addFinalState,
newState, newTransition,
newState, newStates,
newTransition,
mapStates, mapTransitions,
oneFinalState,
moveLabelsToNodes, minimize,
@@ -65,6 +66,10 @@ newState :: a -> FA n a b -> (FA n a b, n)
newState x (FA g s ss) = (FA g' s ss, n)
where (g',n) = newNode x g
newStates :: [a] -> FA n a b -> (FA n a b, [(n,a)])
newStates xs (FA g s ss) = (FA g' s ss, ns)
where (g',ns) = newNodes xs g
newTransition :: n -> n -> b -> FA n a b -> FA n a b
newTransition f t l = onGraph (newEdge (f,t,l))