next up previous
Next: ALE Up: Hdrug. A Flexible and Previous: Introduction



This section gives an overview of the functionality provided by Hdrug.


Hdrug provides three ways of interacting with the underlying NLP system:

The first two approaches are mutually exclusive: if the command interpreter is listening, then you cannot give ordinary Prolog commands and vice versa. In contrast, the graphical user interface (with mouse-driven menu's and buttons) can always be used. This feature is very important and sets Hdrug apart from competing systems. It implies that we can use at the same time the full power of the Prolog prompt (including tracing) and the graphical user interface. Using the command interpreter (with a history and alias mechanism) can be useful for experienced users, as it might be somewhat faster than using the mouse (but note that many menu options can be selected using accelerators). Furthermore, it is useful for situations in which the graphical user interface is not available (e.g. in the absence of an X workstation). The availability of a command-line interface in combination with mouse-driven menu's and buttons illustrates the flexible nature of the interface.

An important and interesting property of both the command interpreter and the graphical user interface is extendibility. It is very easy to add further commands (and associated actions) to the command interpreter (using straightforward DCG syntax). The graphical user interface can be extended by writing Tcl/Tk scripts, possibly in combination with some Prolog code. A number of examples will be given in the remainder of this paper.

Finally note that it is also possible to run Hdrug without the graphical user interface present (simply give the -notk option at startup). This is sometimes useful if no X workstation is available (e.g. if you connect to the system over a slow serial line), but also for batch processing. At any point you can start or stop the graphical user interface by issuing a simple command.


Hdrug supports the visualisation of a large collection of data-structures into a number of different formats.

These formats include 2:

Figure 1: Example of visualisation provided by Hdrug. In this example the derivation tree for the sentence `ik wil vroeger' ( I want earlier) is shown in a TK widget.

The Tk Canvas format is the format best integrated with the graphical user interface. The data-structures for which visualisation is provided are:

Parser and Generator Management

Hdrug provides an interface for the definition of parsers and generators. Hdrug manages the results of a parse or generation request. You can inspect these results later. Multiple parsers and generators can co-exist. You can compare some of these parsers with respect to speed and memory usage on a single example sentence, or on sets of pre-defined example sentences. Furthermore, actions can be defined which are executed right before parsing (generation) starts, or right after the construction of each parse result (generation result), or right after parsing is completed. For example, in the ALE system to be discussed in the next section, a parse-tree is shown automatically for each parse result. As another example, for the OVIS system discussed in section 4, a word graph is read-in in an ASCII buffer and converted to an appropriate Prolog format before parsing starts.

Useful libraries

Most of the visualisation tools are available through libraries as well. In addition, the Hdrug library contains mechanisms to translate Prolog terms into feature structures and vice versa (on the basis of a number of declarations). Furthermore, a library is provided for the creation of `Mellish' Prolog terms on the basis of boolean expressions over finite domains [7]. The reverse translation is provided too. Such terms can be used as values of feature structures to implement a limited form of disjunction and negation by unification.

A number of smaller utilities is provided in the library as well, including libraries which extend term_expansion, an add_clause mechanism (based on chapter 9.1 of [8]), management of global variables (the predicate flag/3 from [11]), support for debugging, etc.

Example Applications

A number of example applications is included in the Hdrug distribution.

next up previous
Next: ALE Up: Hdrug. A Flexible and Previous: Introduction
Noord G.J.M. van