mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-11 04:02:52 -06:00
gf works with the new gfcc format
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
module GF.Speech.GrammarToVoiceXML (grammar2vxml) where
|
||||
|
||||
import GF.Canon.CanonToGFCC (mkCanon2gfcc)
|
||||
import qualified GF.Canon.GFCC.AbsGFCC as C
|
||||
import GF.Canon.GFCC.DataGFCC (GFCC(..), Abstr(..), mkGFCC, lookMap)
|
||||
|
||||
import qualified GF.GFCC.AbsGFCC as C
|
||||
import GF.GFCC.DataGFCC (GFCC(..), Abstr(..), mkGFCC)
|
||||
import GF.GFCC.Macros
|
||||
import qualified GF.Canon.GFC as GFC
|
||||
import GF.Canon.AbsGFC (Term)
|
||||
import GF.Canon.PrintGFC (printTree)
|
||||
@@ -65,14 +65,14 @@ prid :: VIdent -> String
|
||||
prid (C.CId x) = x
|
||||
|
||||
vSkeleton :: GFC.CanonGrammar -> (VIdent,VSkeleton)
|
||||
vSkeleton = gfccSkeleton . mkGFCC . mkCanon2gfcc
|
||||
vSkeleton = gfccSkeleton . mkCanon2gfcc
|
||||
|
||||
gfccSkeleton :: GFCC -> (VIdent,VSkeleton)
|
||||
gfccSkeleton gfcc = (absname gfcc, ts)
|
||||
where a = abstract gfcc
|
||||
ts = [(c,[(f,ft f) | f <- fs]) | (c,fs) <- Map.toList (cats a)]
|
||||
ts = [(c,[(f,ft f) | f <- fs]) | (c,fs) <- Map.toList (catfuns a)]
|
||||
ft f = case lookMap (error $ prid f) f (funs a) of
|
||||
C.Typ args _ -> args
|
||||
(ty,_) -> fst $ GF.GFCC.Macros.catSkeleton ty
|
||||
|
||||
--
|
||||
-- * Questions to ask
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
module GF.Speech.TransformCFG where
|
||||
|
||||
import GF.Canon.CanonToGFCC (mkCanon2gfcc)
|
||||
import qualified GF.Canon.GFCC.AbsGFCC as C
|
||||
import GF.Canon.GFCC.DataGFCC (GFCC, mkGFCC, lookType)
|
||||
import qualified GF.GFCC.AbsGFCC as C
|
||||
import GF.GFCC.Macros (lookType,catSkeleton)
|
||||
import GF.GFCC.DataGFCC (GFCC)
|
||||
import GF.Conversion.Types
|
||||
import GF.CF.PPrCF (prCFCat)
|
||||
import GF.Data.Utilities
|
||||
@@ -70,7 +71,7 @@ cfgToCFRules s =
|
||||
nameToTerm (Name IW [Unify [n]]) = CFRes n
|
||||
nameToTerm (Name f@(IC c) prs) =
|
||||
CFObj f (zipWith profileToTerm args prs)
|
||||
where C.Typ args _ = lookType gfcc (C.CId c)
|
||||
where (args,_) = catSkeleton $ lookType gfcc (C.CId c)
|
||||
nameToTerm n = error $ "cfgToCFRules.nameToTerm" ++ show n
|
||||
profileToTerm (C.CId t) (Unify []) = CFMeta t
|
||||
profileToTerm _ (Unify xs) = CFRes (last xs) -- FIXME: unify
|
||||
@@ -84,7 +85,7 @@ getStartCatCF :: Options -> StateGrammar -> String
|
||||
getStartCatCF opts sgr = getStartCat opts sgr ++ "{}.s"
|
||||
|
||||
stateGFCC :: StateGrammar -> GFCC
|
||||
stateGFCC = mkGFCC . mkCanon2gfcc . stateGrammarST
|
||||
stateGFCC = mkCanon2gfcc . stateGrammarST
|
||||
|
||||
-- * Grammar filtering
|
||||
|
||||
|
||||
Reference in New Issue
Block a user