From a4ba93cc556dadc33ed95abd9baac0d29236bcfe Mon Sep 17 00:00:00 2001 From: bringert Date: Wed, 4 Jan 2006 21:41:12 +0000 Subject: Build SLF networks with sublattices. --- src/GF/Speech/FiniteState.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/GF/Speech/FiniteState.hs') diff --git a/src/GF/Speech/FiniteState.hs b/src/GF/Speech/FiniteState.hs index 539db8e0a..632c20830 100644 --- a/src/GF/Speech/FiniteState.hs +++ b/src/GF/Speech/FiniteState.hs @@ -22,7 +22,7 @@ module GF.Speech.FiniteState (FA, State, NFA, DFA, oneFinalState, moveLabelsToNodes, minimize, dfa2nfa, - prFAGraphviz) where + prFAGraphviz, faToGraphviz) where import Data.List import Data.Maybe @@ -213,13 +213,14 @@ dfa2nfa = mapTransitions Just -- prFAGraphviz :: (Eq n,Show n) => FA n String String -> String -prFAGraphviz = Dot.prGraphviz . toGraphviz +prFAGraphviz = Dot.prGraphviz . faToGraphviz "" prFAGraphviz_ :: (Eq n,Show n,Show a, Show b) => FA n a b -> String -prFAGraphviz_ = Dot.prGraphviz . toGraphviz . mapStates show . mapTransitions show +prFAGraphviz_ = Dot.prGraphviz . faToGraphviz "" . mapStates show . mapTransitions show -toGraphviz :: (Eq n,Show n) => FA n String String -> Dot.Graph -toGraphviz (FA (Graph _ ns es) s f) = Dot.Graph Dot.Directed [] (map mkNode ns) (map mkEdge es) +faToGraphviz :: (Eq n,Show n) => String -- ^ Graph ID + -> FA n String String -> Dot.Graph +faToGraphviz i (FA (Graph _ ns es) s f) = Dot.Graph Dot.Directed i [] (map mkNode ns) (map mkEdge es) [] where mkNode (n,l) = Dot.Node (show n) attrs where attrs = [("label",l)] ++ if n == s then [("shape","box")] else [] @@ -231,4 +232,4 @@ toGraphviz (FA (Graph _ ns es) s f) = Dot.Graph Dot.Directed [] (map mkNode ns) -- lookups :: Ord k => [k] -> Map k a -> [a] -lookups xs m = mapMaybe (flip Map.lookup m) xs \ No newline at end of file +lookups xs m = mapMaybe (flip Map.lookup m) xs -- cgit v1.2.3