From ddda900d53ee3b8fa968bc8acb49f035f9ef860c Mon Sep 17 00:00:00 2001 From: bringert Date: Mon, 12 Sep 2005 14:46:44 +0000 Subject: Completed unoptimized SLF generation. --- src/GF/Speech/SRG.hs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/GF/Speech/SRG.hs') 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 -- cgit v1.2.3