Kahina for QType Tutorial Part 1: First Steps

It is still possible to execute operations such as compiling grammars and parsing sentences from the console, but in this sequence of tutorials, we will exclusively use the new GUI to show how these operations are performed in it. In this first tutorial, you will learn how to start Kahina, how to load projects, and how to compile grammars.

Starting Kahina in Main Mode

If Kahina for QType is correctly installed, all that is required to start the Kahina GUI is to issue the command gui at the QType prompt. Depending on the version of Kahina you are running, there might now be considerable output on the console, before a screen-filling window with many GUI components is built up. Welcome to Kahina.

Loading a Tutorial Project

In Kahina, a QType grammar is always bundled in a project together with a range of settings that determine the user interface layout as well as the tracing behavior. To be able to rely on a standardized and somewhat simplified environment for this tutorial, we have predefined several example projects. For the first three tutorials, our example project will be based on the example grammar shieb4.qtg, which Kahina will look for in the GRM/QTG directory of your QType distribution.

A list of all predefined projects can be found in the menu under Project -> Open Project -> Predefined Projects. The list should contain a project named QType Tutorials 1-3, which we shall need for the purposes of this and the following two tutorials. In order to open this project, you need to click on its list entry, which will cause the Kahina GUI to shortly disappear and be rebuilt with a different layout. Your Kahina window should now look roughly like this:

A First Tour of the View Components

Before we go any further, it is worthwhile to take a first cursory look at Kahina's GUI components. From now on, these components will often be referred to using the terminology we introduce here, so this is an important step towards familiarizing yourself with Kahina, which will make it a lot easier to understand the explanations in subsequent tutorials.

Just below the menu, we have the control panel, a row of buttons which will later allow you to issue commands to the underlying QType instance while tracing. The exact meaning of these commands will be discussed in QTypeTutorial2. The two buttons on the right will be used in QTypeTutorial3 for flipping backward and forward through the selection history, much like the Back and Forward buttons in a browser.

The component at the right border of the Kahina window is the message console, which will essentially display an interactive variant of a usual Prolog trace during the debugging process, but will often enhance this trace with additional information. At the moment, only one step is mentioned, the symbolic query root, standing for the underlying QType process which is currently waiting for orders. The message console plays an important role in all subsequent tutorials.

The query root is also the only step which shows up in the step tree just below the control panel. The step tree display is separated into two views representing different levels of detail: the overview tree on the left and the detail tree on the right. At the moment, both views display the same single tree root. Parent-child relationships in the step tree are expressed by indentation. As you will learn in QTypeTutorial3, the step tree gives access to both the call structure and the search structure of a Prolog process.

The source display is an integrated source code editor which serves to display relevant bits of QType's source code and/or the grammar file, indicating by highlights which lines of the code are involved in the current computation. As we have not started any computation yet, the source display remains empty for now.

The goal display will contain graphical representations of the goal being called. This will especially become relevant for goals whose arguments represent feature structures, as it includes an elegant feature structure visualization. Parse trees will also be displayed in this view.

Compiling the Grammar

To compile the grammar defined by the project, activate the menu item Grammar -> Compile. Kahina now switches to a tracing mode which would allow you to explore in minute detail how the grammar is compiled. The compilation process for this grammar in full detail consists of more than tracing 25.000 steps.

While this level of detail can be useful for debugging grammars which do not compile, in this tutorial we are not interested in the internals of this process. We will therefore skip the entire compilation step, by telling Kahina to let QType compile the grammar under the hood without informing the Kahina instance about the internals. To skip the current step, you can either press the 'S' key (TODO), or press the skip button in the control panel:

After the skip command was issued, Kahina will wait until QType has finished the compilation. Once the skip was completed, the display of the compilation step in the control flow tree will change its color from black to green, the signal color indicating that a step was successfully completed. The situation at the end of this tutorial should therefore look roughly like this:

Further Steps

We are now ready to inspect a parse process. Continue to QTypeTutorial2 to learn about parsing and tracing.

Last modified 6 years ago Last modified on Oct 7, 2012, 12:58:05 PM

Attachments (3)

Download all attachments as: .zip