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.
+ 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)
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.
* 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
By adding a header
Access-Control-Allow-Origin: *
to the HTTP responses, web browsers are informed that it is OK to call the
services from web pages hosted on other sites.
This is apparently supported in most modern browsers, so it should no longer
be necessary to resort to JSONP.
See https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS
The package network-2.4.1.1 thoughlessly introduced a backward incompatible
change to the function Network.URI.unEscapeString, see
f2168b1f89
This also affects the function Network.Shed.Httpd.queryToArguments, which is
used in GFServer.hs.
To remain compatible with older and newer versions of the network package,
we need to stay clear of queryToArguments and unEscapeString. A replacement
function has been added to server/URLEncoding.hs.
The &+ operator is now consistently eliminated from the output of commmands
that produce linearizations. Before, only the commands translate and
translategroup did this.
The new options are
* noleaves, nofun, nocat (booleans, false by default)
* nodefont, leaffont, nodecolor, leafcolor, nodeedgestyle, leafedgestyle
(strings, empty by default)
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.
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.
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.
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.
+ 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.
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}]}
+ 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.
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.
+ The flag fastcgi is removed: building the fastcgi is the main purpose of
this cabal file again.
+ pgf-http superseded by gf-server, but is still available as an option
+ Require cgi>=3001.7.3 instead of cgi>=3001.8.0.
"gf -server" mode now includes PGF service and the services to support
example-based grammar writing. (But gf -server is not quite ready to replace
pgf-http yet...)
Also bumped GF version number to 3.2.10-darcs
This was a bug in my workaround for a bug in the httpd-shed package. It
made it impossible to use the glue token "&+" for Turkish input in the minibar,
for example.
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.
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