diff options
| author | bringert <bringert@cs.chalmers.se> | 2007-06-25 16:25:58 +0000 |
|---|---|---|
| committer | bringert <bringert@cs.chalmers.se> | 2007-06-25 16:25:58 +0000 |
| commit | 862c780f78ae6d3b4495b56a2070d1ec1ff25e5c (patch) | |
| tree | 50ebe21fecec811c619c7080cb95fe6f1dcbcec9 /src/GF/Speech/FiniteState.hs | |
| parent | b086183c0fb9363000804bd68c2cb22ac3c964a9 (diff) | |
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.
Diffstat (limited to 'src/GF/Speech/FiniteState.hs')
| -rw-r--r-- | src/GF/Speech/FiniteState.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/GF/Speech/FiniteState.hs b/src/GF/Speech/FiniteState.hs index 7c62ee0f8..35274e3c4 100644 --- a/src/GF/Speech/FiniteState.hs +++ b/src/GF/Speech/FiniteState.hs @@ -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) |
