PGF2 & PGFService: work in progress on callbacks for nerc & chunks

This commit is contained in:
hallgren
2015-01-20 14:57:52 +00:00
parent 1fa59f7554
commit 3f3df9a719
2 changed files with 81 additions and 5 deletions

View File

@@ -151,9 +151,14 @@ cpgfMain command (t,(pgf,pc)) =
tp (tree,prob) = makeObj ["tree".=tree,"prob".=prob]
-- Without caching parse results:
parse' start mlimit ((_,concr),input) =
return $
maybe id take mlimit . drop start # C.parse concr cat input
parse' start mlimit ((from,concr),input) =
return $
maybe id take mlimit . drop start # cparse
where
cparse = C.parse concr cat input
--cparse = C.parseWithHeuristics concr cat input (-1) callbacks
callbacks = maybe [] cb $ lookup (C.abstractName pgf) C.literalCallbacks
cb fs = [(cat,f pgf (from,concr))|(cat,f)<-fs]
{-
-- Caching parse results:
parse' start mlimit ((from,concr),input) =