mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
predef types in gfcc
This commit is contained in:
@@ -177,7 +177,9 @@ paramValues cgr = (labels,untyps,typs) where
|
||||
jments = [(m,j) | (m,mo) <- M.allModMod cgr, j <- tree2list $ M.jments mo]
|
||||
typs = Map.fromList [(ci,Map.fromList (zip vs [0..])) | (ci,vs) <- params]
|
||||
untyps = Map.fromList $ concatMap Map.toList [typ | (_,typ) <- Map.toList typs]
|
||||
lincats = [(cat,ls) | (_,(cat,CncCat (RecType ls) _ _)) <- jments]
|
||||
lincats =
|
||||
[(IC cat,[Lbg (L (IC "s")) TStr]) | cat <- ["Int", "Float", "String"]] ++
|
||||
[(cat,ls) | (_,(cat,CncCat (RecType ls) _ _)) <- jments]
|
||||
labels = Map.fromList $ concat
|
||||
[((cat,[lab]),(typ,i)):
|
||||
[((cat,[lab2,lab]),(ty,j)) |
|
||||
|
||||
@@ -39,13 +39,16 @@ generateRandom gen gfcc cat = genTrees (randomRs (0.0, 1.0) gen) cat where
|
||||
(genTrees ds2 cat) -- else (drop k ds)
|
||||
|
||||
genTree rs = gett rs where
|
||||
gett ds (CId "String") = (Tr (AS "foo") [], 1)
|
||||
gett ds (CId "Int") = (Tr (AI 12345) [], 1)
|
||||
gett ds cat = case fns cat of
|
||||
fs -> let
|
||||
d:ds2 = ds
|
||||
(f,args) = getf d fs
|
||||
(ts,k) = getts ds2 args
|
||||
in (Tr (AC f) ts, k+1)
|
||||
getf d fs = fs !! floor (d * fromIntegral (length fs))
|
||||
getf d fs = let lg = (length fs) in
|
||||
fs !! (floor (d * fromIntegral lg))
|
||||
getts ds cats = case cats of
|
||||
c:cs -> let
|
||||
(t, k) = gett ds c
|
||||
|
||||
Reference in New Issue
Block a user