mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
Removed the old srg printer, which produced SRGS ABNF.
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
----------------------------------------------------------------------
|
||||
-- |
|
||||
-- Module : CFtoSRG
|
||||
-- Maintainer : Markus Forsberg
|
||||
-- Stability : (stable)
|
||||
-- Portability : (portable)
|
||||
--
|
||||
-- > CVS $Date: 2005/04/21 16:21:10 $
|
||||
-- > CVS $Author: bringert $
|
||||
-- > CVS $Revision: 1.6 $
|
||||
--
|
||||
-- This module prints a CF as a SRG (Speech Recognition Grammar).
|
||||
-- Created : 21 January, 2001.
|
||||
-- Modified : 16 April, 2004 by Aarne Ranta for GF 2.
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
module GF.CF.CFtoSRG (prSRG) where
|
||||
|
||||
import GF.Data.Operations
|
||||
import GF.CF.CF
|
||||
import GF.CF.CFIdent
|
||||
---import UseGrammar
|
||||
import GF.CF.PPrCF
|
||||
import Data.List (intersperse,nub)
|
||||
|
||||
header :: String
|
||||
header = unlines ["#ABNF 1.0 ISO-8859-1;\n",
|
||||
"language en;",
|
||||
"mode voice;",
|
||||
"root $Main;",
|
||||
"meta \"author\" is \"Grammatical Framework\";\n"]
|
||||
|
||||
prSRG :: CF -> String
|
||||
prSRG cf = (header ++) $ prSRGC (catsOfCF cf) cf
|
||||
|
||||
prSRGC :: [CFCat] -> CF -> String
|
||||
prSRGC [] _ = []
|
||||
prSRGC (c:cs) cf = "$" ++ prCFCat c ++ " = " ++ items ++ ";\n"++ prSRGC cs cf
|
||||
where items = concat $ intersperse " | " $
|
||||
map f $ nub $ map valItemsCF (rulesForCFCat cf c)
|
||||
f [] = "$NULL"
|
||||
f xs = unwords $ map prSRGItem xs
|
||||
|
||||
prSRGItem :: CFItem -> [Char]
|
||||
prSRGItem (CFNonterm c) = "$" ++ prCFCat c
|
||||
prSRGItem (CFTerm a) = prRegExp a
|
||||
|
||||
@@ -58,7 +58,6 @@ import GF.CF.PrLBNF
|
||||
import GF.Grammar.PrGrammar
|
||||
import GF.Compile.PrOld
|
||||
import GF.Canon.MkGFC
|
||||
import GF.CF.CFtoSRG
|
||||
import GF.Speech.PrGSL (gslPrinter)
|
||||
import GF.Speech.PrJSGF (jsgfPrinter)
|
||||
import GF.Speech.PrSRGS
|
||||
@@ -248,7 +247,7 @@ customGrammarPrinter =
|
||||
,(strCI "gf", \_ -> err id prGrammar . canon2sourceGrammar . stateGrammarST)
|
||||
,(strCI "cf", \_ -> prCF . stateCF)
|
||||
,(strCI "old", \_ -> printGrammarOld . stateGrammarST)
|
||||
,(strCI "srg", \_ -> prSRG . stateCF)
|
||||
,(strCI "srg", srgsAbnfPrinter Nothing False)
|
||||
,(strCI "gsl", gslPrinter)
|
||||
,(strCI "jsgf", jsgfPrinter Nothing)
|
||||
,(strCI "jsgf_sisr_old", jsgfPrinter (Just SISR.SISROld))
|
||||
|
||||
Reference in New Issue
Block a user