A Prototype Natural Language Interface for Temporal Databases

1. Introduction

This directory contains the software that accompanies the book "Exploring Time, Tense and Aspect in Natural Language Database Interfaces" (hereafter, "the Book") by Ion Androutsopoulos. The Book was published by John Benjamins in 2002. 

The software of this directory implements a prototype natural language interface for temporal databases (NLITDB), built according to the theory of the Book. The prototype is only intended to demonstrate that the theoretical framework of the Book is implementable. The prototype is not a fully-fledged natural language interface, and it would have to be extended in several ways if it were to be used in real-life applications (see Chapter 6 of the Book). You will need to read the Book to understand the internals of the prototype. See Chapter 2 of the Book for a description of the linguistic coverage of the theory on which the prototype is based.

The Book is a revised version of the PhD thesis "A Principled Framework for Constructing Natural Language Interfaces to Temporal Databases" (hereafter, "the Thesis") by the same author, University of Edinburgh, 1996. The software of this directory is an updated version of the software that accompanied the Thesis. The main change is that the prototype now uses ALE v.3.2.1, instead of ALE v.2.0.2, which has led to very significant speed improvements.

2. Software and hardware requirements

The prototype NLITDB was tested using SWI Prolog 5.0.1, which is currently available with the Lesser GNU Public License for both Unix and Windows platforms. It should be possible to install and use the NLITDB on any Unix or Windows machine that has SWI Prolog 5.0.1 or later installed. It should also be possible to use the NLITDB with other Prolog versions with relatively minor changes.

The prototype NLITDB uses ALE, a logic programming, grammar parsing, and generation system, which was developed by Bob Carpenter and Gerald Penn. ALE is also distributed with the Lesser GNU Public License. A copy of ALE v.3.2.1 for SWI Prolog is included in this directory.

The files of the prototype NLITDB (excluding ALE) are distributed with the GNU General Public License (v.2).

3. Contents of this directory

This directory contains the following files:
  1. index.html: This file.
  2. GNU_GPL.txt: Plain ASCII copy of the GNU General Public License v.2.
  3. GNU_LGPL.txt: Plain ASCII copy of the GNU Lesser General Public License v.2.1.
  4. nlitdb.tar.gz: Compressed Unix tar file containing the following files. (Windows users use a utility like WinZip.)
  5. ale_3_1_2.tar.gz: Compressed Unix tar file containing the following files:

4. Acknowledgments

Many thanks to Chris Brew who was the original author of avl_io.pl. Parts of the grammar in nli_hpsg.pl are based on previous ALE encodings of HPSG fragments by Suresh Manandhar and Claire Grover, which were in turn based on grammars by Gerald Penn and Bob Carpenter. The author is indebted to all of them.

5. Installing and using the prototype NLITDB

To install the prototype NLITDB, first copy the files nlitdb.tar.gz and ale_3_1_2.tar.gz into the same directory. Uncompress and untar them. For example, on Unix systems you would type something like the following; Windows users use a utility like WinZip.

   gunzip nlitdb.tar.gz
   tar xvf nlitdb.tar
   gunzip ale_3_1_2.tar.gz
   tar xvf ale_3_1_2.tar
   rm nlitdb.tar ale_3_1_2.tar

The NLITDB uses a file to write temporary data. Modify nli_tmp_file/1 in loader.pl to specify the path and name of this file. The file has to be in a directory where you have write permission. For example, if you wish the temporary file to be /home/mydir/nli_tmp, modify nli_tmp_file/1 as follows:


You then have to set the argument of chronons/1 in loader.pl to a string showing the TSQL2 name of the granularity of chronons (e.g. "DAY", "MINUTE", or "SECOND"). For example, if chronons correspond to minutes, chronons/1 should be as below:


Next, start SWI Prolog and consult loader.pl. (Windows users, double-click on loader.pl.) This will load ALE and all the modules of the NLITDB. Ignore warnings about clauses not being in the same files and absence of functional descriptions.

   ?- [loader].

You can now submit questions (as lists of Prolog atoms) using the nli/1 predicate as shown below:

   ?- nli([which,runways,were,closed,yesterday]).

The system processes the questions and generates the corresponding HPSG signs, the TOP (logic-like) formulae that represent the semantics of the questions, and the TSQL2 translations of the TOP formulae. As explained in the Book, the prototype NLITDB is currently not linked to a database management system. Hence, the resulting TSQL2 queries are not evaluated.

The NLITDB is currently configured for a hypothetical airport database (see Chapter 6 of the Book). The file test_nli.pl contains sample questions demonstrating the linguistic phenomena that the system can or cannot handle. If you want to try all the sample questions in test_nli.pl, type the following after loading ALE and the modules of the NLITDB.

   ?- [test_nli].

This will submit to the NLITDB all the sample questions, and will generate all the resulting HPSG signs, TOP formulae, and TSQL2 queries.

Ion Androutsopoulos. Last update: September 10th, 2002