How to Run XLE in the Computational Linguistics Lab (CAL 514)

Stephen Wechsler, 1/30/08

 

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.

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.)

 

To run XLE: 

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.

3. Pull down the menu (by left-clicking the mouse) in the upper left corner of the screen, with the word Applications. 

4. Select System Tools; on the System Tools menu select Terminal.  You should see a Terminal window.

5. At the terminal prompt, type the following five lines, pressing Return after each line:

 

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: 

 

 

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:

 

create-parser my-first-lfg-grammar.lfg

 

Now parse the test sentence it works by typing:

 

parse {it works}

 

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. 

 

7. Now look at your grammar.  Go back to the Terminal window and type this:

 

      more my-first-lfg-grammar.lfg

 

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.

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.

 

Survival Unix

The Terminal uses a Unix operating system.  Here are some commands that you may need:

 

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.

 

Note:  There is also a "point and click" type file browser (toplevel menu > Applications > System Tools > File Browser).

 

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.) 

xleide.tcl .  The simplest editor is a small program called xleide.tcl that George Bronnikov wrote for us: 

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.

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.

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. 

 

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:

 

      hw1-yourlastname.lfg

      hw2-yourlastname.lfg

            ...etc.

 

For example, if your name is Mary Einstein, the homework number is hw8, the name should be:

 

      hw8-einstein.lfg

 

Type h in lowercase; Unix likes to interpret uppercase as a directory name. 

 

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):

 

  % chmod  600 my_hw_file

  % cp my_hw_file /groups/classes/syntax2

 

The chmod makes it so no one else can read your file, and cp copies it.

 

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

 

            ssh -X username@quiche.ling.utexas.edu

 

where username is replaced with your username.