summaryrefslogtreecommitdiff
path: root/src/GF/Speech/PrJSGF.hs
diff options
context:
space:
mode:
authorbringert <bringert@cs.chalmers.se>2007-01-21 16:33:44 +0000
committerbringert <bringert@cs.chalmers.se>2007-01-21 16:33:44 +0000
commit169659c096a38f8fc0cf48e3054efbdf30a96c8c (patch)
treebaf3f08f571514fe113055ce7dfd321e746b1f44 /src/GF/Speech/PrJSGF.hs
parentb974ab06cdd64ba1db9278516fbd5803f236d5ee (diff)
Get speechLanguage flag from both command-line and grammar. Reformat it to RFC3066 format (- instead of _) and use it in SRGS, VoiceXML and JSGF.
Diffstat (limited to 'src/GF/Speech/PrJSGF.hs')
-rw-r--r--src/GF/Speech/PrJSGF.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/GF/Speech/PrJSGF.hs b/src/GF/Speech/PrJSGF.hs
index 8b12443a0..f6f0b19b2 100644
--- a/src/GF/Speech/PrJSGF.hs
+++ b/src/GF/Speech/PrJSGF.hs
@@ -34,6 +34,7 @@ import GF.Compile.ShellState (StateGrammar)
import Data.Char
import Data.List
+import Data.Maybe
import Text.PrettyPrint.HughesPJ
import Debug.Trace
@@ -44,13 +45,15 @@ jsgfPrinter :: Maybe SISRFormat
jsgfPrinter sisr opts s = show $ prJSGF sisr $ makeSimpleSRG opts s
prJSGF :: Maybe SISRFormat -> SRG -> Doc
-prJSGF sisr srg@(SRG{grammarName=name,startCat=start,origStartCat=origStart,rules=rs})
+prJSGF sisr srg@(SRG{grammarName=name,grammarLanguage=ml,
+ startCat=start,origStartCat=origStart,rules=rs})
= header $++$ mainCat $++$ vcat topCatRules $++$ foldr ($++$) empty (map prRule rs)
where
- header = text "#JSGF V1.0 UTF-8;" $$
+ header = text "#JSGF" <+> text "V1.0" <+> text "UTF-8" <+> lang <> char ';' $$
comment ("JSGF speech recognition grammar for " ++ name) $$
comment "Generated by GF" $$
text ("grammar " ++ name ++ ";")
+ lang = maybe empty text ml
mainCat = comment ("Start category: " ++ origStart) $$
rule True "MAIN" [prCat start]
prRule (SRGRule cat origCat rhs) =