1
0
forked from GitHub/gf-core

Some clean-up in finite-state network generation: MFA now keeps track of start lattice name, instead of having a wrapper lattice. Replaced MFALabel with Symbol.

This commit is contained in:
bringert
2007-06-25 16:25:58 +00:00
parent b086183c0f
commit 862c780f78
4 changed files with 39 additions and 45 deletions

View File

@@ -15,7 +15,7 @@ module GF.Speech.FiniteState (FA(..), State, NFA, DFA,
startState, finalStates,
states, transitions,
isInternal,
newFA,
newFA, newFA_,
addFinalState,
newState, newStates,
newTransition, newTransitions,
@@ -73,6 +73,14 @@ newFA :: Enum n => a -- ^ Start node label
newFA l = FA g s []
where (g,s) = newNode l (newGraph [toEnum 0..])
-- | Create a new finite automaton with an initial and a final state.
newFA_ :: Enum n => (FA n () b, n, n)
newFA_ = (fa'', s, f)
where fa = newFA ()
s = startState fa
(fa',f) = newState () fa
fa'' = addFinalState f fa'
addFinalState :: n -> FA n a b -> FA n a b
addFinalState f (FA g s ss) = FA g s (f:ss)