summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2007-03-26 17:36:58 +0000
committerbringert <bringert@cs.chalmers.se>2007-03-26 17:36:58 +0000
commit5abf240a988bbb2670301c4fd875cb000fad0540 (patch)
treece39226d592c21eb37c2429e3453e27ca39fe1bb /src
parent3797cfd11ed270f609df5422103a8142c6a1e024 (diff)
Remove all empty SLF nodes, don't care about edge explosion. Empty nodes are pprobably worse than lots of edges.
Diffstat (limited to 'src')
-rw-r--r--src/GF/Speech/FiniteState.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/GF/Speech/FiniteState.hs b/src/GF/Speech/FiniteState.hs
index 69b8de457..7c62ee0f8 100644
--- a/src/GF/Speech/FiniteState.hs
+++ b/src/GF/Speech/FiniteState.hs
@@ -184,8 +184,7 @@ moveLabelsToNodes = onGraph f
removeTrivialEmptyNodes :: (Eq a, Ord n) => FA n (Maybe a) () -> FA n (Maybe a) ()
removeTrivialEmptyNodes = pruneUnusable . skipSimpleEmptyNodes
--- | Move edges to empty nodes with exactly one outgoing edge
--- or exactly one incoming edge to point to the next node(s).
+-- | Move edges to empty nodes to point to the next node(s).
-- This is not done if the pointed-to node is a final node.
skipSimpleEmptyNodes :: (Eq a, Ord n) => FA n (Maybe a) () -> FA n (Maybe a) ()
skipSimpleEmptyNodes fa = onGraph og fa
@@ -196,10 +195,12 @@ skipSimpleEmptyNodes fa = onGraph og fa
info = nodeInfo g
changeEdge e@(f,t,())
| isNothing (getNodeLabel info t)
- && (inDegree info t == 1 || outDegree info t == 1)
+ -- && (i * o <= i + o)
&& not (isFinal fa t)
= [ (f,t',()) | (_,t',()) <- getOutgoing info t]
| otherwise = [e]
+-- where i = inDegree info t
+-- o = outDegree info t
isInternal :: Eq n => FA n a b -> n -> Bool
isInternal (FA _ start final) n = n /= start && n `notElem` final