Grammatikformalismen
The XLE parser for LFG is installed on all department servers, under
/proj/contrib/XLE/current/bin/xle
XLE wants to open windows on your computer that display parse results, over the Internet using the X Window System. In order to do this, you need to run an X Server on your own computer to which XLE can send the windows. Do this in two steps, as follows.
Connecting to the Coli servers from your computer
First, you need to connect to login
from your computer using ssh with X forwarding. Do this as follows:
login
with X forwarding.ssh -Y login.coli.uni-saarland.de
. The flag -Y
turns on X forwarding.ssh -Y login
from there.Once you have logged into login
, run xterm
on login to check that this opens a window on your computer. Feel free to close the xterm window; it is only to check that your connection works correctly.
Running XLE on a Coli server
The login
server is not meant to run compute-intensive jobs, so connect to a compute server with X forwarding (e.g. run ssh -Y forbin
on the shell of login
). This will send X windows from the compute server, to login
, to your computer.
Once you are in the shell of the compute server, start XLE with the command shown above.
Editing grammars on the Coli server
Because XLE is running on a different machine, not on your own computer, you will need to either edit your grammar directly on the server, or you can edit it on your own computer and then upload it to the server after each edit.
To edit directly on the server, you can use an editor such as vi
or emacs
on the server. If you run emacs
, it will open in graphical mode by default and send its windows to your computer via X, which can be good if your Internet connection is fast enough. Otherwise, you can run it with emacs -nw
(nw = no window) to get the Emacs editor to run inside your ssh terminal.
Alternatively, you can edit the grammar file on your own computer with the editor of your choice. Then you will need to upload the file to login
with your favorite scp
client (e.g. WinSCP on Windows or Cyberduck on MacOS). You can also mount your home directory on login
into your own computer using e.g. SSHFS-Win (Windows) or Mountain Duck (MacOS). Note that your home directory on login
is the same as on the compute servers, so whatever you upload to login
will be directly available on the compute server.
The on-line XLE documentation contains a clear walkthrough with all the basic stuff. You can ignore Sections 2.5 (Templates), 3.4 (Projections), and 4 (Transfer Walkthrough). You can also ignore all the bits about installing an emacs-mode.
There are only a few commands you will need to use for this assignment.
create-parser FILE
: This loads the grammar in FILE.parse "STRING"
: Tries to parse the string with the root category defined in
your grammar as the goal category.parse {CAT: STRING}
: Tries to parse the string with CAT as goal category.help [COMMAND]
: Gives some very concise help. If you leave out the COMMAND
argument, you get a list of commands.exit
: Exits.In addition, a parse command will open (at least) an f-structure and a c-structure window. You can middle-click on c-structure nodes to show associated f-structures to investigate what works and what doesn’t. If there are more (partial) parse trees, one can use the next and previous buttons to cycle through the c-structures.
In the f-structure window, one can toggle the ‘c’-option to show/hide all constraints that exist for the f-structure.
Here is an example run. Assume that you are on forbin in a directory that also contains demo-eng.lfg, a toy LFG grammar from PARC.
forbin:~$ /proj/contrib/XLE/current/bin/xle
XLE loaded from /proj/contrib/XLE/current/bin/xle.
XLEPATH = /proj/contrib/XLE/current/bin.
[...]
Type 'help' for more information.
% create-parser demo-eng.lfg
loading /home/AK/koller/demo-eng.lfg...
Grammar has 5 rules with 16 states, 17 arcs, and 17 disjuncts (17 DNF).
[...]
% parse "Mary saw the sheep with the telescope"
parsing {Mary saw the sheep with the telescope}
4 solutions, 0.01 CPU seconds, 23 subtrees unified
% exit
A list of translations of LFG notation to XLE notation can be found in the documentation.
Some things to keep in mind with respect to notation:
(^ SUBJ)
. XLE will not necessarily complain if you don’t, but things
will not parse correctly.{ }
. Optionality
of a RHS c-structure element is indicated with ( )
.This document was originally created by Gerlof Bouma at the University of Potsdam and then revised by Alexander Koller.