From 862c780f78ae6d3b4495b56a2070d1ec1ff25e5c Mon Sep 17 00:00:00 2001 From: bringert Date: Mon, 25 Jun 2007 16:25:58 +0000 Subject: 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. --- src/GF/Speech/FiniteState.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/GF/Speech/FiniteState.hs') 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) -- cgit v1.2.3