diff options
| author | bringert <bringert@cs.chalmers.se> | 2007-01-05 14:34:20 +0000 |
|---|---|---|
| committer | bringert <bringert@cs.chalmers.se> | 2007-01-05 14:34:20 +0000 |
| commit | 741dde5a2a00dc737e570a7005663c2534ea4f6d (patch) | |
| tree | 6aebd85fc4d9417a0bb3fbfb450fcf3ea72101b8 /src/GF/Speech/PrGSL.hs | |
| parent | 2b1c6763cc29857ba2890a12eb4330f6e03edd06 (diff) | |
Change input to the different SRG printers to be StateGrammar instead of CGrammar. This to allow looking at the types in SISR, and to reduce the number of argument passed from Custom.
Diffstat (limited to 'src/GF/Speech/PrGSL.hs')
| -rw-r--r-- | src/GF/Speech/PrGSL.hs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/GF/Speech/PrGSL.hs b/src/GF/Speech/PrGSL.hs index d9e248499..c60b9eae4 100644 --- a/src/GF/Speech/PrGSL.hs +++ b/src/GF/Speech/PrGSL.hs @@ -27,18 +27,19 @@ import GF.Conversion.Types import GF.Infra.Print import GF.Infra.Option import GF.Probabilistic.Probabilistic (Probs) +import GF.Compile.ShellState (StateGrammar) import Data.Char (toUpper,toLower) -gslPrinter :: Ident -- ^ Grammar name - -> String -- ^ Start category - -> Options -> Maybe Probs -> CGrammar -> String -gslPrinter name start opts probs cfg = prGSL srg "" - where srg = topDownFilter $ makeSimpleSRG name start opts probs $ rmPunctCFG cfg +gslPrinter :: Ident -- ^ Grammar name + -> String -- ^ Start category + -> Options -> StateGrammar -> String +gslPrinter name start opts = + prGSL . topDownFilter . makeSimpleSRG name start opts -prGSL :: SRG -> ShowS +prGSL :: SRG -> String prGSL (SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs}) - = header . mainCat . unlinesS (map prRule rs) + = (header . mainCat . unlinesS (map prRule rs)) "" where header = showString ";GSL2.0" . nl . comments ["Nuance speech recognition grammar for " ++ name, @@ -59,12 +60,14 @@ firstToUpper :: String -> String firstToUpper [] = [] firstToUpper (x:xs) = toUpper x : xs +{- rmPunctCFG :: CGrammar -> CGrammar rmPunctCFG g = [CFRule c (filter keepSymbol ss) n | CFRule c ss n <- g] keepSymbol :: Symbol c Token -> Bool keepSymbol (Tok t) = not (all isPunct (prt t)) keepSymbol _ = True +-} -- Nuance does not like upper case characters in tokens showToken :: Token -> String |
