summaryrefslogtreecommitdiff
path: root/src/GF/Speech/SRG.hs
diff options
context:
space:
mode:
authorbringert <unknown>2005-09-12 14:46:44 +0000
committerbringert <unknown>2005-09-12 14:46:44 +0000
commitddda900d53ee3b8fa968bc8acb49f035f9ef860c (patch)
treeb83a52f978fbeffda4ed95d936b55a91b9f6c535 /src/GF/Speech/SRG.hs
parentf882f97a22c9ed16c6f1735930698b8fba162351 (diff)
Completed unoptimized SLF generation.
Diffstat (limited to 'src/GF/Speech/SRG.hs')
-rw-r--r--src/GF/Speech/SRG.hs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/GF/Speech/SRG.hs b/src/GF/Speech/SRG.hs
index 9f4919ed2..6d88a677e 100644
--- a/src/GF/Speech/SRG.hs
+++ b/src/GF/Speech/SRG.hs
@@ -5,9 +5,9 @@
-- Stability : (stable)
-- Portability : (portable)
--
--- > CVS $Date: 2005/09/07 14:21:30 $
+-- > CVS $Date: 2005/09/12 15:46:44 $
-- > CVS $Author: bringert $
--- > CVS $Revision: 1.15 $
+-- > CVS $Revision: 1.16 $
--
-- Representation of, conversion to, and utilities for
-- printing of a general Speech Recognition Grammar.
@@ -58,24 +58,18 @@ makeSRG i opts gr = SRG { grammarName = name,
where
name = prIdent i
origStart = getStartCat opts
- gr' = removeLeftRecursion $ removeEmptyCats $ cfgToCFRules gr
+ gr' = removeLeftRecursion $ removeIdenticalRules $ removeEmptyCats $ cfgToCFRules gr
(cats,cfgRules) = unzip gr'
names = mkCatNames name cats
cfgRulesToSRGRule :: FiniteMap String String -> [CFRule_] -> SRGRule
cfgRulesToSRGRule names rs@(r:_) = SRGRule cat origCat rhs
- where origCat = ruleCat r
+ where origCat = lhsCat r
cat = lookupFM_ names origCat
rhs = nub $ map (map renameCat . ruleRhs) rs
renameCat (Cat c) = Cat (lookupFM_ names c)
renameCat t = t
-ruleCat :: CFRule c n t -> c
-ruleCat (CFRule c _ _) = c
-
-ruleRhs :: CFRule c n t -> [Symbol c t]
-ruleRhs (CFRule _ r _) = r
-
mkCatNames :: String -- ^ Category name prefix
-> [String] -- ^ Original category names
-> FiniteMap String String -- ^ Maps original names to SRG names