forked from GitHub/gf-core
generate metavariables in the tree extraction for PMCFG
This commit is contained in:
@@ -108,18 +108,19 @@ extractExps (State pinfo chart items) start = exps
|
|||||||
let FFun fn _ lins = functions pinfo ! funid
|
let FFun fn _ lins = functions pinfo ! funid
|
||||||
lbl <- indices lins
|
lbl <- indices lins
|
||||||
Just fid <- [lookupPC (PK cat lbl 0) (passive st)]
|
Just fid <- [lookupPC (PK cat lbl 0) (passive st)]
|
||||||
go Set.empty fid
|
go Set.empty 0 (0,fid)
|
||||||
|
|
||||||
go rec fcat
|
go rec fcat' (d,fcat)
|
||||||
| Set.member fcat rec = mzero
|
| fcat < totalCats pinfo = [Meta (fcat'*10+d)] -- FIXME: here we assume that every rule has at most 10 arguments
|
||||||
| otherwise = foldForest (\funid args trees ->
|
| Set.member fcat rec = mzero
|
||||||
do let FFun fn _ lins = functions pinfo ! funid
|
| otherwise = foldForest (\funid args trees ->
|
||||||
args <- mapM (go (Set.insert fcat rec)) args
|
do let FFun fn _ lins = functions pinfo ! funid
|
||||||
return (Fun fn args)
|
args <- mapM (go (Set.insert fcat rec) fcat) (zip [0..] args)
|
||||||
`mplus`
|
return (Fun fn args)
|
||||||
trees)
|
`mplus`
|
||||||
(\lit _ trees -> Lit lit : trees)
|
trees)
|
||||||
[] fcat (forest st)
|
(\lit _ trees -> Lit lit : trees)
|
||||||
|
[] fcat (forest st)
|
||||||
|
|
||||||
|
|
||||||
process fn !seqs !funs [] acc chart = (acc,chart)
|
process fn !seqs !funs [] acc chart = (acc,chart)
|
||||||
|
|||||||
Reference in New Issue
Block a user