summaryrefslogtreecommitdiff
path: root/src/GF/Speech/FiniteState.hs
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2006-01-04 21:41:12 +0000
committerbringert <bringert@cs.chalmers.se>2006-01-04 21:41:12 +0000
commita4ba93cc556dadc33ed95abd9baac0d29236bcfe (patch)
treecef6d169c72484ec7e187859a905a9c9247ac5e8 /src/GF/Speech/FiniteState.hs
parente22275d467fe78930d2510219a98283422a8a452 (diff)
Build SLF networks with sublattices.
Diffstat (limited to 'src/GF/Speech/FiniteState.hs')
-rw-r--r--src/GF/Speech/FiniteState.hs13
1 files changed, 7 insertions, 6 deletions
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