From cb18297acef067f0072ff290bedbb2f11f703eb8 Mon Sep 17 00:00:00 2001 From: bringert Date: Thu, 8 Dec 2005 16:01:13 +0000 Subject: SLF generation: make sure that there is only one final node, and that it is actually final. --- src/GF/Speech/PrSLF.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/GF/Speech/PrSLF.hs') diff --git a/src/GF/Speech/PrSLF.hs b/src/GF/Speech/PrSLF.hs index eba50a7e8..1e614d140 100644 --- a/src/GF/Speech/PrSLF.hs +++ b/src/GF/Speech/PrSLF.hs @@ -48,12 +48,16 @@ data SLFEdge = SLFEdge { eId :: Int, eStart :: Int, eEnd :: Int } slfPrinter :: Ident -- ^ Grammar name -> Options -> CGrammar -> String -slfPrinter name opts cfg = prSLF (automatonToSLF $ moveLabelsToNodes $ dfa2nfa $ cfgToFA name opts cfg) "" +slfPrinter name opts cfg = prSLF (automatonToSLF $ mkSLFFA name opts cfg) "" slfGraphvizPrinter :: Ident -- ^ Grammar name -> Options -> CGrammar -> String slfGraphvizPrinter name opts cfg = - prFAGraphviz $ mapStates (fromMaybe "") $ mapTransitions (const "") $ moveLabelsToNodes $ dfa2nfa $ cfgToFA name opts cfg + prFAGraphviz $ mapStates (fromMaybe "") $ mapTransitions (const "") $ mkSLFFA name opts cfg + +mkSLFFA :: Ident -- ^ Grammar name + -> Options -> CGrammar -> FA State (Maybe String) () +mkSLFFA name opts cfg = oneFinalState Nothing () $ moveLabelsToNodes $ dfa2nfa $ cfgToFA name opts cfg automatonToSLF :: FA State (Maybe String) () -> SLF automatonToSLF fa = -- cgit v1.2.3