summaryrefslogtreecommitdiff
path: root/src/server/PGFService.hs
AgeCommit message (Collapse)Author
2014-04-28Spring cleaninghallgren
Nothing major...
2014-04-16PGF web API: adding the command c-wordforwordhallgren
It has the same parameters and result format as c-translate, but it does the translation word for word. (To be used as a last resort).
2014-04-15PGF web API: add commands lookupmorpho and c-lookupmorphohallgren
2014-04-10PGF web service: disable caching of parse resultshallgren
Caching parse results uses a lot of memory, even if they expire after 2 minutes, so it won't scale up to many simultaneous users. But some excessive memory use seems to be caused by space leaks in (the Haskell binding to) the C run-time system, and these should be fixed. For example, flushing the PGF cache does not release the memory allocated by the C run-time system when loading a PGF file.
2014-04-09PGF web service: add unlexers and enable client side cachinghallgren
Most PGF web API commands that produce linearizations now accept an unlexer parameter. Possible values are "text", "code" and "mixed". The web service now include Date and Last-Modified headers in the HTTP, responses. This means that browsers can treat responses as static content and cache them, so it becomes less critical to cache parse results in the server. Also did some cleanup in PGFService.hs, e.g. removed a couple of functions that can now be imported from PGF.Lexing instead.
2014-04-09PGF Service: a bit more clever lexer=texthallgren
Only change the first word to lowercase if the original input is not found in the grammar's morphology. This allows parsing of sentenses starting with "I" in English, nouns in German and proper names in other languages, but it can make the wrong choice for multi-words.
2014-04-08Fix build problem in PGFService.hs when configured without c-runtimehallgren
2014-04-08PGF web service: add lexer supporthallgren
The PGF web API commands parse, translate, translategroup, c-parse and c-translate now support a lexer parameter. Possible values are "text", "code" and "mixed". This is used in the Wide Coverage Demo App to save one server roundtrip.
2014-04-04PGFService.hs: adapt to changes in the Haskell binding to the C run-time systemhallgren
Parse errors used to cause crashes, but they are now handled and reported.
2014-03-19gf -server: add a command to manually flush the PGF cachehallgren
This can be used if the cloud service seems slow, but it would probably be better to automatically expire unused PGFs from the cache after some time.
2014-03-12Fix typo in PGFService: "incomlete"john.j.camilleri
2014-02-11Work on web api & apps based on the C run-time systemhallgren
+ PGFService.hs: add command c-grammar, include probability in parse results + js/gftranslation.js: add start position and limit parameters, return more info to applications + Simple Translator: show two wide coverage translations + Wide coverage demo: show parse tree and probability (intended as grammar debugging aids)
2014-02-10Fix broken C runtime support in gf.cabal and PGFService.hshallgren
Also add PGF service command c-flush to explicitly flush cached parse results from memory.
2014-01-27PGFService.hs: fix a type ambiguity when compiling without C run-time supporthallgren
2014-01-27PGFService.hs: add a cache for C run-time parse result and a start offset ↵hallgren
parameter Cached parse results are discarded when they have been unused for 10 minutes.
2014-01-20Optionally include C run-time supporthallgren
If the C run-time library is compiled and installed on your system, you can now do 'cabal configure -fc-runtime' to get the following extras: + The haskell binding to the C run-time library will be included in the PGF library (so you can import it in Haskell applications). Documentation on the new modules will be included when you run 'cabal haddock'. + The new command 'pgf-shell', implemented on top of haskell binding to the C run-time system. + Three new commands in the web API: c-parse, c-linearize and c-translate. Their interfaces are similar to the corresponding commands without the "c-" prefix, but they should be considered preliminary.
2013-10-30linref is now used by the linearizer. The visible change is that the 'l' ↵kr.angelov
command in the shell now can linearize discontinuous phrases
2013-10-24Functions merge trees into tries in the GF Shell and the PGF web servicehallgren
* In the shell, the new command tt (to_trie) merges a list of trees into a trie and prints it in a readable way, where unique subtrees are marked with a "*" and alternative subtrees are marked with numbers. * In the PGF web service, adding the parameter trie=yes to the parse and translate commands augments the JSON output with a trie. Example to try in the shell: Phrasebook> p -lang=Eng "your son waits for you" | tt
2013-04-24PGF service: apply the token binding operator &+ to all linearizationshallgren
The &+ operator is now consistently eliminated from the output of commmands that produce linearizations. Before, only the commands translate and translategroup did this.
2013-03-28PGF web API: command=abstrtree not supports the nocat and nofun optionshallgren
2013-03-27PGF web API: add comand linearizeTablehallgren
The new command linearizeTable outputs linearizations as tables containing all variants and forms, labelled by parameters
2013-03-26PGF service: support all parse tree visualziation options in the web APIhallgren
The new options are * noleaves, nofun, nocat (booleans, false by default) * nodefont, leaffont, nodecolor, leafcolor, nodeedgestyle, leafedgestyle (strings, empty by default)
2013-03-13PGF web API: add 'to' parameter to the 'alignment' commandhallgren
Word alignment diagrams can now be restricted to a subset of the languages supported by the grammar.
2013-03-13PGF web API: generalize the 'to' parameter to accept a list of languageshallgren
Some commands (linearize, linearizeAll, random, generate, translate and translategroup) by default produce output in all languages supported by the grammar and the 'to' parameter could be used to restrict output to a single language. Now you can restrict the output to a list of languages. Languages should be separated by spaces. Also removed an unnecessary LANGUAGE pragma and reduced code verbosity.
2013-03-09ghc-7.6: fix src/server/PGFService.hs (use catch from base-4 Control.Exception)Sergei Trofimovich
2013-01-18Add fun/cat printnames to PGF web servicejohn.j.camilleri
This is accessible vis the `browse` command, by adding the flag `printnames` e.g.: .../Letter.pgf?command=browse&id=Recipient&format=json&printnames=1
2013-01-09Fixes for minibar offlinehallgren
Tested it in Firefox 18 (which has the new Ionmonkey JavaScript engine). Still get stack overflows.
2013-01-09PGF service: new command: downloadhallgren
This makes it possible to download PGF files from servers where the PGF service is installed. I am also considering making commmand=download the default instead of command=grammar.
2012-12-20PGFService.hs: code duplication reductionhallgren
2012-11-22PGFService.hs: fix type error caused by change to PGF.graphvizParseTreehallgren
Note that some of the graphviz functions have backwards incompatible changes that might also affect other clients of the PGF run-time library. Also added graphvizDefaults and export it together with GraphvizOptions from the PGF run-time library.
2012-11-17PGF service: command=browse&format=json returns info on all cats and funshallgren
The browse command used to have a required parameter id=... and it returned info on the given identifier only. Now, if format=json, the id=... parameter can be omitted to get info on all identifiers at the same time. The returned JSON structure in this case is {cats:{...},funs:{...}} where the inner objects contain one field per category and function, respectively, in the same format as when you request info on one category or function.
2012-09-30PGF service & minibar: put a limit on the number of parse treeshallgren
+ In the PGF web service API, the commands parse, translate and translategroup now accept a limit parameter. It limits the number of parse trees returned. If no limit is given, the behaviour is backwards compatible, i.e. no limit is applied. + In minibar, the limit is now set to 25 by default. This change is based on a suggestion by Kaarel Kaljurand.
2012-04-02PGFService.hs: add web API function "abstrjson"hallgren
Abstract syntax trees are represented as strings in the web API. To make them easier to manipulate in JavaScript, the new function converts them to JSON. To support structural editing, the nodes are numbered in the same way as in the bracketed string created when linearizing an abstract syntax tree. Example: "Pred (That Fish) Fresh" is converted to {fun:"Pred",fid:3, children:[{fun:"That",fid:1, children:[{fun:"Fish",fid:0}]}, {fun:"Fresh",fid:2}]}
2012-03-18PGF run-time library: function names in BracketedString (experimental)hallgren
+ Make room for function names in the BracketedString data structure. + Fill in function names when linearizing an abstract syntax tree to a BracketedString. + Fill in wildCId when it is not obvious what the function is. + Function bracketedLinearize: for compatibility with the other linearization functions, return Leaf "" instead of error "cannot linearize". + Export flattenBracketedString from module PGF. + PGFServce: make function names available in the JSON representation of BracketedString.
2012-03-16PGFService.hs: command=browse can now produce output in JSON format.hallgren
To get JSON output, add the parameter format=json. The JSON structure contains the output from the function PGF.browse. The default is format=html for backwards compatibility.
2012-03-08PGFService.hs: add output format option to the commands abstrtree, parsetree ↵hallgren
and alignment Supported output formats: gv, png, svg.
2012-02-29PGFService.hs bug fix: pattern match failure in doParsehallgren
doParse was missing a branch for PGF.ParseIncomplete. Also introduced the operator .= to simply the code that builds JSON objects.
2011-10-18pgf service: include the start category in grammar infohallgren
2011-08-24pgf-service: apply the OpenMath LaTeX function only when linearizing to ahallgren
concrete language whose name ends with LaTeX. This change also avoids duplicating output and, in addition to the linearize command, applies the transfer also when using the linearizeAll command.
2011-08-23pgf-service: add Jordis transfer function for OpenMath LaTeX outputhallgren
2011-08-22pgf service: external service hook: always format the output as a JSON stringhallgren
2011-08-22pgf service: added a hook for external serviceshallgren
This is really reinventing CGI, people should learn how to write CGI scripts instead... TODO: better handling of temporary files
2011-06-21gf-server: make pgf-service work the Apache mod_fastcgihallgren
pgf-service now appears to works with Apache mod_fastcgi (under Mac OS X) in addition to lighttpd. One difference appears to be that while lighttpd passes the name of the PGF file in the SCRIPT_FILENAME variable, Apache passes it in PATH_TRANSLATED. But perhaps this depends on exactly how the fastcgi service is configured. The following is what I added to the Apache configuration file to test this: <Directory /Library/WebServer/Documents/fcgi-bin> SetHandler fastcgi-script Options +ExecCGI </Directory> Action pgf-service /fcgi-bin/pgf-service AddHandler pgf-service .pgf
2011-03-07the user can now upload their own grammars in the editorkrasimir
2010-11-26Split pgf-server into pgf-fcgi and pgf-http.hallgren
The dependency on the fastcgi package made pgf-server difficult to compile, so it is now split into - pgf-fgci (main module in pgf-fcgi.hs), which is built only if fastcgi is already installed or if you turn on the fastcgi flag (e.g. by doing 'cabal install -f fastcgi'). - pgf-http (main module in pgf-http.hs) which is always built (and hopefully has no problematic dependencies.) The modules FastCGIUtils and PGFService no longer depend on fastcgi.
2010-11-25pgf-server: more useful JSON output from lineraizeAllhallgren
Example: Request: http://www.grammaticalframework.org:41296/grammars/Quiz.pgf?command=linearizeAll&tree=Run+YouPl Response: [{"to":"QuizEng","texts":["you run"]}, {"to":"QuizSwe","texts":["ni l??per","ni springer"]}] Compared to the old command linearize: Request: http://www.grammaticalframework.org:41296/grammars/Quiz.pgf?command=linearize&tree=Run+YouPl' Response: [{"to":"QuizEng","text":"you run"}, {"to":"QuizSwe","text":"ni l??per"}]
2010-11-24linearizeAll in PGFServiceaarne
2010-11-09Make PGFService.hs compile againhallgren
+ PGFService.hs: add Nothing arguments in calls to PGF.parse_ and PGF.getPArseOutput + gf-server.cabal: mark content-server as not buildable, since required source files are missing.
2010-10-13the PGF service now can do both random and exhaustive generation. these ↵krasimir
functions now return both the generated tree and its linearization
2010-10-02refactor the API for random generation again. Now PGF contains probabilities ↵krasimir
in the abstract syntax