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.
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).
tar xvf nlitdb.tar
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.
You can now submit questions (as lists of Prolog atoms) using the nli/1 predicate as shown below:
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.
This will submit to the NLITDB all the sample questions, and will generate all the resulting HPSG signs, TOP formulae, and TSQL2 queries.