mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 03:32:51 -06:00
PGF web service: add command c-linearizeAll to obtain all variants
Implemented by calling the recently added function PGF2.linearizeAll.
This commit is contained in:
@@ -130,6 +130,7 @@ cpgfMain qsem command (t,(pgf,pc)) =
|
|||||||
"c-parse" -> withQSem qsem $
|
"c-parse" -> withQSem qsem $
|
||||||
out t=<< join (parse # input % start % limit % treeopts)
|
out t=<< join (parse # input % start % limit % treeopts)
|
||||||
"c-linearize" -> out t=<< lin # tree % to
|
"c-linearize" -> out t=<< lin # tree % to
|
||||||
|
"c-linearizeAll"-> out t=<< linAll # tree % to
|
||||||
"c-translate" -> withQSem qsem $
|
"c-translate" -> withQSem qsem $
|
||||||
out t=<<join(trans # input % to % start % limit%treeopts)
|
out t=<<join(trans # input % to % start % limit%treeopts)
|
||||||
"c-lookupmorpho"-> out t=<< morpho # from1 % textInput
|
"c-lookupmorpho"-> out t=<< morpho # from1 % textInput
|
||||||
@@ -190,6 +191,11 @@ cpgfMain qsem command (t,(pgf,pc)) =
|
|||||||
purge r@(_,t') = if diffUTCTime t t'<120 then Just r else Nothing
|
purge r@(_,t') = if diffUTCTime t t'<120 then Just r else Nothing
|
||||||
-- remove unused parse results after 2 minutes
|
-- remove unused parse results after 2 minutes
|
||||||
-}
|
-}
|
||||||
|
linAll tree to = showJSON (linAll' tree to)
|
||||||
|
linAll' tree (tos,unlex) =
|
||||||
|
[makeObj ["to".=to,
|
||||||
|
"texts".=map unlex (C.linearizeAll c tree)]|(to,c)<-tos]
|
||||||
|
|
||||||
lin tree to = showJSON (lin' tree to)
|
lin tree to = showJSON (lin' tree to)
|
||||||
lin' tree (tos,unlex) =
|
lin' tree (tos,unlex) =
|
||||||
[makeObj ["to".=to,"text".=unlex (C.linearize c tree)]|(to,c)<-tos]
|
[makeObj ["to".=to,"text".=unlex (C.linearize c tree)]|(to,c)<-tos]
|
||||||
|
|||||||
Reference in New Issue
Block a user