How to Run XLE in the Computational Linguistics
Lab (CAL 514)
Stephen Wechsler,
1/30/08
<!--[if
!supportEmptyParas]--> <!--[endif]-->
XLE is a
computational environment that assists in writing and debugging Lexical
Functional Grammars. With XLE you can write LFG syntax rules and lexical entries
and test your grammar by parsing sentences. XLE is installed
in the Computational Lab in CAL 514.
<!--[if
!supportEmptyParas]--><!--[endif]--> All students in Syntax II should
have an account in the Computational Lab. If yours is a new
account then you should have received an email with your username, password, and
instructions on how to change your password.
To start
the computer:
1. Go to
CAL 514 and pick a machine. You should see a screen with
spaces for username and password. Type in your
username and password and press Return.
(Alternatively, you
can access the XLE system remotely via ssh. See the end of
this document for information.)
<!--[if
!supportEmptyParas]--> <!--[endif]-->
To run
XLE:
<!--[if
!supportEmptyParas]--><!--[endif]--> 2. If you prefer, you can open a
web browser (e.g. Mozilla browser, Firefox, Netscape, etc.) and open this
document from
http://uts.cc.utexas.edu/~wechsler/Syntax2/xle/intro.htm so that you can
copy and paste commands. Or else type them in by
hand.
<!--[if
!supportEmptyParas]--><!--[endif]--> 3. Pull down the menu (by
left-clicking the mouse) in the upper left corner of the screen, with the word
Applications.
<!--[if
!supportEmptyParas]--><!--[endif]--> 4. Select System Tools; on the
System Tools menu select Terminal. You should see a Terminal
window.
<!--[if
!supportEmptyParas]--><!--[endif]--> 5. At the terminal prompt, type
the following five lines, pressing Return after each line:
<!--[if
!supportEmptyParas]--> <!--[endif]-->
source
/usr/local/bin/xle-setup
mkdir
xle-grammars
cd xle-grammars
cp
/groups/classes/syntax2/grammars/my-first-lfg-grammar.lfg .
xle
Be sure to
include the period after a space in the fourth line; this period represents the
current working directory (a directory is the same as a folder).
The commands that you just typed perform the following tasks,
respectively:
<!--[if
!supportEmptyParas]--> <!--[endif]-->
<!--[if
!supportEmptyParas]--> <!--[endif]-->
6. The last
command (xle) should give you a terminal window with xle at the top, and % as
the line prompt. Now you are in the XLE environment, and you
have a small grammar called my-first-lfg-grammar.lfg so that you can try it
out. To create a parser from this grammar,
type:
<!--[if
!supportEmptyParas]--> <!--[endif]-->
create-parser
my-first-lfg-grammar.lfg
<!--[if
!supportEmptyParas]--> <!--[endif]-->
Now parse
the test sentence it works by typing:
<!--[if
!supportEmptyParas]--> <!--[endif]-->
parse {it
works}
<!--[if
!supportEmptyParas]--> <!--[endif]-->
This should
open a graphic interface with several windows, with representations of the
sentence, including the c-structure (upper left) and f-structure (upper
right). Congratulations, you've done it.
<!--[if
!supportEmptyParas]--> <!--[endif]-->
7. Now look
at your grammar. Go back to the Terminal window and type
this:
<!--[if
!supportEmptyParas]--> <!--[endif]-->
more my-first-lfg-grammar.lfg
<!--[if
!supportEmptyParas]--> <!--[endif]-->
more is the Unix command to display a file,
stopping at each page (hit the space bar to scroll down a page).
The grammar consists of a phrase structure grammar and a
lexicon. Go back to the Terminal window and try parsing a few
more sentences that you think this grammar will handle. Also, try
parsing a sentence that you think it will NOT parse, and see what happens.
<!--[if !supportEmptyParas]-->8. See "Editing Your Grammars" below for some options for editing your grammar. Save your changes with a new filename; always use the .lfg suffix. For a homework assignment, follow the instructions below on naming your grammar. Run create-parser on your new grammar and try it out on some sentences.
9. Follow
the instructions below to hand in your assignment.
10. To end
the XLE session type exit.
Then log out from your session: System > Log Out.
<!--[if
!supportEmptyParas]--> <!--[endif]-->
Survival
Unix
The
Terminal uses a Unix operating system. Here are some commands
that you may need:
<!--[endif]-->
|
ls |
lists
files and directories (=folders) in the current directory |
|
cd
DirectoryName |
enters the directory (within
the current one) called DirectoryName |
|
cd |
Goes
to the topmost directory |
|
cd
.. |
Moves
up one level to parent directory |
|
mv
oldfn newfn |
Changes filename from oldfn to
newfn |
|
mv
filename DirectoryName |
Moves
the file filename into the directory DirectoryName |
|
mkdir
DirectoryName |
Makes
a new directory called DirectoryName |
|
rm
filename |
Removes (deletes) the file
called filename |
|
rmdir
DirectoryName |
Removes the directory called
DirectoryName |
|
more filename |
Displays the file called
filename, stopping after each page. |
<!--[if
!supportEmptyParas]--> <!--[endif]-->
Note: There is
also a "point and click" type file browser (toplevel menu > Applications > System Tools > File
Browser).
<!--[if
!supportEmptyParas]--> <!--[endif]-->
Editing
your grammars
You can use
any text editor to edit your grammar. (Complex editors such
as Word insert invisible formatting information that can cause
problems.)
<!--[if
!supportEmptyParas]--><!--[endif]-->
1. Open the
file browser (toplevel menu > Applications > System Tools > File
Browser).
2. Navigate
to your grammar file.
3. Click
right button, Open with; look for Open with
xleide.tcl on the
list of options, and select it if its there. (If it is not
there then select Open with Other
Application. At the bottom
of the window click Use a custom command; there, either enter /home/goga/src/xleide.tcl, or select this file using the
Browse button.)
4. A window
opens with an editor and an entry field at the bottom. You edit the grammar,
enter a sentence in the entry field, and push the "Parse"
button. XLE starts using your current grammar (it is saved
automatically) and the example you entered.
<!--[if
!supportEmptyParas]-->emacs is a
popular editor. The Emacs editor in the Lab has an "LFG mode" with special
features to make it easier to edit XLE grammars. Type emacs to start it. When you open a
file with the .lfg suffix, it should go into LFG mode
automatically.
<!--[endif]-->
Other
editors. Another good option is
jedit . jedit is a
simple screen editor that allows the usual cut and paste operations with the
mouse. To use jedit, type jedit& at the command
line. The jedit editor opens with a help page on top; just
close the help page and you will see an editing window. From
there you can use the pull-down menus to open files, edit them, and save
them. Note that for any changes to take effect in XLE you
must exit and restart XLE, and do the create-parser command again.
<!--[if
!supportEmptyParas]--> <!--[endif]-->
Naming
and handing in XLE grammars for homework
When you
are have completed a grammar for homework, give it a file name using the
following convention, where hw1 is homework #1 (etc.) and yourlastname is your
last name in lowercase:
<!--[if
!supportEmptyParas]--> <!--[endif]-->
hw1-yourlastname.lfg
hw2-yourlastname.lfg
...etc.
<!--[if
!supportEmptyParas]--> <!--[endif]-->
For
example, if your name is Mary Einstein, the homework number is hw8, the name
should be:
<!--[if
!supportEmptyParas]--> <!--[endif]-->
hw8-einstein.lfg
<!--[if
!supportEmptyParas]--> <!--[endif]-->
Type h in
lowercase; Unix likes to interpret uppercase as a directory name.
<!--[if
!supportEmptyParas]--> <!--[endif]-->
To hand in
your homework, you will copy your grammar file to the following directory:
/groups/classes/syntax2 . Type these commands (where % is the
prompt and my_hw_file is the name of your
file):
<!--[if
!supportEmptyParas]--> <!--[endif]-->
%
chmod 600 my_hw_file
% cp
my_hw_file
/groups/classes/syntax2
<!--[if
!supportEmptyParas]--> <!--[endif]-->
The chmod
makes it so no one else can read your file, and cp copies
it.
<!--[if
!supportEmptyParas]--> <!--[endif]-->
Remote
access
You can
access the XLE remotely from another computer, if you have access to ssh (Secure
Shell). For the XLE graphics to display on a Mac you will
need to install the utility X11 Windows, which is a standard option with
recent Macs. First open X11 Windows. Then open the Terminal
utility. In the Terminal window of your computer,
type
<!--[if
!supportEmptyParas]--> <!--[endif]-->
ssh -X username@quiche.ling.utexas.edu
<!--[if
!supportEmptyParas]--> <!--[endif]-->
where
username is
replaced with your username.
<!--[if
!supportEmptyParas]--> <!--[endif]-->