Grammatikformalismen
The XLE parser for LFG is installed on all department servers, under
/proj/contrib/XLE/current/bin/xle
You start XLE by calling the executable from the shell. Make sure you are connecting to the server via ssh with X-forwarding (ssh -Y <hostname>
), because XLE will display parse results in new windows. If you are getting an error message about “DISPLAY”, check that you really have X-forward turned on by trying to run xterm
from the shell.
Use forbin
or some other compute server to run XLE, not login
. You can ssh -Y into login and then ssh -Y from there to the compute server of your choice, and the X-forwarding will be passed through to your desktop or laptop computer.
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.
In XLE, 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.