g3
(prefixed by the installation
directory if this is necessary on your system) and to test some grammars.
The menu bar at the top of the window contains the [File], [Window], [Options] and [Help] menus. By convention, this tutorial will refer to the selection of a menu item by indicating [Menu] or [Menu/Submenu] in the text. For example, [Help/About This Grammar...] means selecting the About This Grammar... submenu of the [Help] menu.
The white rectangular are below the menu bar will contain the example phrases for a given grammar, once a grammar is loaded.
Below the example phrases area is the sentence input area. It allows you to enter a new sentence and goal formula.
Finally, at the bottom of the window there are four buttons for frequently used actions: [Parse], for parsing the current sentence in the sentence input area, [Lexicon], for opening the lexicon window, [Load], for loading a grammar, and [Quit], for exiting Grail.
gv
window by selecting
[Window/Postscript Window] from the Grail menu bar. The
Graphviz window will be updated to reflect the current status of
lexical entries and, during parsing, to reflect the current status of
the parse.
For the moment, if Graphviz
and gv
have been
correctly installed, the Graphviz window
will just display a simple welcome message.
Macintosh users may prefer to use Pixelglow's excellent front end to the Graphviz package. In case you do so, manually open Graphviz and from the Graphviz application, select [File/Open...] to open the file tmp.dot
in your current directory.
If you use other software which can directly portray Graphviz files,
follow the same strategy. Open the file tmp.dot
from this
software. If you use other software to display the graphs, it is
highly recommended that you choose software which updates the display
whenever the displayed file is changed, since Grail will change the
file tmp.dot
(and the corresponding postscript file
tmp.ps
) rather frequently.
tar xvfz grammars.tgz
if you haven't done so
already.
We can load and save grammars by using the [File]
menu. [File/Load Grammar...] (or, equivalently, the load
command button at the bottom of the window) opens up a file selection dialog
window which allows you to pick a grammar file which will be loaded
into Grail. Enter the grammars
directory which contains the example grammars and select the grail0.pl
grammar.
The main window will change and look as shown in the figure.
The sentence input area now contains the example sentences of the
grail0.pl
grammar. The entries starting with
---
are comments about the type of sentences which
follows them and will not be parsed.
If you prefer editing your grammars in your own favorite editor, which
is recommended when you have a bit of experience with Grail and Grail
grammars, you can open the file grail0.pl
in your
editor. A later section will explain
this is more detail.
Once a grammar has been edited manually, you can select [File/Reload Grammar] to load this grammar file into Grail.
When you are editing a grammar using Grail's editing facilities, you can save the edited grammar using [File/Save Grammar...] it is recommended for this tutorial not to overwrite the grammar files and to select a new filename when saving a grammar.
Finally, [File/Quit] (or, equivalently, the [Quit] button)
exits Grail. Don't forget to save your grammar if you made any changes
to it, since Grail will assume you are an adult and won't ask you for
a confirmation when you select quit.
Inspecting the Grammar
By clicking the [Lexicon] button (or by selecting
[Window/Lexicon Window] for the menu bar), the lexicon window will
open. The figure shows the lexicon window for the current
grail0.pl
grammar. The lexicon window has a menu bar at the top. Below the menu bar there is a list of the words in the lexicon, in alphabetic order. The bottom part of the lexicon window contains the facilities for editing lexical entries which will be explained in a later section.
The lexicon window can be closed by selecting [Window/Close] from the menu bar of the lexicon window.
Grail assigns graphs to lexical entries. Click on an entry to see its assigned graph (or assigned graphs in case an word has multiple graphs assigned to it) in the Graphviz window. The <cursor up> and <cursor down> keys will move you to the next and previous lexical entry respectively. The meaning of these lexical graphs will be explained in the following sections.
As an alternative presentation of the lexicon, if you have pdfLaTeX and a pdf viewer installed on your system, as recommended by the installation instructions, you can select [Window/Lexicon Window (LaTeX/pdf)] to have a pdf viewer window open with a LaTeX representation of the lexicon. This may take a few seconds, depending on your system. Here, the formulas corresponding to the lexical graphs are shown. The correspondence is made explicit in one of the appendices. This option is unavailable when the configure script doesn't find either pdfLaTeX or a pdf previewer.
If you are familiar with categorial grammars and want to know straight away how lexical formulas are converted into lexical graphs, your can read this in one of the appendices before continuing with the section on AB grammars.