To illustrate the functionality of Hdrug we use Bob Carpenter and Gerald Penn's ALE system . To quote the authors:
ALE is an integrated phrase structure parsing and definite clause logic programming system in which the terms are typed feature structures. Typed feature structures combine type inheritance and appropriateness specifications for features and their values. The feature structures used in ALE generalize the common feature structure systems found in the linguistic programming systems PATR-II and FUG, the grammar formalisms HPSG and LFG, as well as the logic programming systems Prolog-II and LOGIN. Programs in any of these languages can be encoded directly in ALE.
Because ALE is available for SICStus Prolog, and because ALE only provides a very limited user interface, it provides a particular simple and useful example of an application for Hdrug. The combined ALE/Hdrug system consists of the original ALE sources plus about 450 lines of Prolog code and 250 lines of Tcl code. These define the interface to Hdrug and provide some useful extensions to the graphical user interface. Apart from this, any specific ALE grammar further specifies a small number of declarations. For the example HPSG grammar which is included in the ALE distribution (a rather large grammar: 1650 lines of ALE code) this required only 8 lines of Prolog code. The following examples assume the HPSG example grammar.
Figure 2 shows the main Hdrug window after loading the ALE system with the HPSG grammar and after the parse of the example sentence she sees a book.
The Hdrug window consists of two large canvases which are used to display important data-structures. In this case the left-most canvas displays the derivation tree of one of the analyses of the example sentence and the right-most canvas displays the feature structure containing the semantic representation of the top-node of one of the parse results. Immediately under the menu-bar a sequence of buttons is displayed which are labelled `1' and `2'. These represent the results of parsing. If such a button is pressed a pull-down menu is displayed which allows the user to visualise that particular result of the parser in one of the available formats. For example, it is possible to inspect the parse tree of this object, where each node of the tree is a feature structure (the result would be to large to be displayed in a readable form here). Note that it is also possible to obtain a visualisation of the feature structure associated with the top-most node of the parse tree in a specific format. These formats include a straightforward interface to ALE's built-in pretty print routines.
The menu-bar provides an interface to many of the standard functions of Hdrug. The FILE menu-button includes options to load grammar files, Prolog files and Tcl/Tk files. The OPTIONS menu provides an interface to global Hdrug variables. Such variables include the value of the top-category for parsing (the start symbol); the default parser; whether or not the system should check if an object is created whether such an object already exists (this feature is used to recognize spurious ambiguities), etc. The PARSE and GENERATE menu buttons are straightforward means to parse a sentence or to generate a sentence for a given logical form. Note that ALE does not provide a generator, so this menu-button is inactive. If a parse is requested a dialog box is displayed in which you can choose a sentence from a predefined set of example sentences, or in which you can type in a new sentence.
The VIEW menu-button is associated with a pull-down menu which is specific to the Ale application. It provides an interface to visualisation routines for the following important ALE datastructures:
For example, the subcat_principle/3 relation is displayed as in Figure 3.