forked from GitHub/gf-core
Merge branch 'master' into c-runtime
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
module GF.Speech.GSL (gslPrinter) where
|
||||
|
||||
import Prelude hiding ((<>))
|
||||
import GF.Grammar.CFG
|
||||
import GF.Speech.SRG
|
||||
import GF.Speech.RegExp
|
||||
@@ -23,14 +24,14 @@ width = 75
|
||||
|
||||
gslPrinter :: Options -> PGF -> Concr -> String
|
||||
gslPrinter opts pgf cnc = renderStyle st $ prGSL $ makeNonLeftRecursiveSRG opts pgf cnc
|
||||
where st = style { lineLength = width }
|
||||
where st = style { lineLength = width }
|
||||
|
||||
prGSL :: SRG -> Doc
|
||||
prGSL srg = header $++$ mainCat $++$ foldr ($++$) empty (map prRule (srgRules srg))
|
||||
where
|
||||
header = ";GSL2.0" $$
|
||||
comment ("Nuance speech recognition grammar for " ++ srgName srg) $$
|
||||
comment ("Generated by GF")
|
||||
comment ("Nuance speech recognition grammar for " ++ srgName srg) $$
|
||||
comment ("Generated by GF")
|
||||
mainCat = ".MAIN" <+> prCat (srgStartCat srg)
|
||||
prRule (SRGRule cat rhs) = prCat cat <+> union (map prAlt rhs)
|
||||
-- FIXME: use the probability
|
||||
|
||||
Reference in New Issue
Block a user