A Package for the Prolog Chat80 System


We completed porting the chat80 system to our Prolog system. We took a source of the chat80 system by Fernando C.N. Pereira and David H.D. Warren and modified it such that it uses the module system of Jekejeke Prolog. We organized the code along some new sub directories:

 +-- database                          % geographic data base
        +-- rivers.pl
        +-- cities.pl
        Etc..
 +-- natural                           % natural language analysis
        +-- newdic.pl
        +-- slots.pl
        Etc..
 +-- chat80.pl                         % main module with predicate hi/0
 +-- edinburgh.pl                      % Edinburgh style I/O utility
 +-- preprocessor.pl                   % conditional compilation utility
 +-- readin.pl                         % sentence input

The chat80 system contains an XG parser that is an improvement over a DCG parser with pushback. It also contains a query planner that generates an optimized Prolog goal from a parse tree. The general flow of the chat80 system is as follows:

  +----------+   +------------+   +--------+   +--------+
->| Parse    |-->| Semantics  |-->| Plan   |-->| Reply  |-->
  +----------+   +------------+   +--------+   +--------+

The system is designed to handle closed yes/no questions about the database and open questions deriving some information from the database. The system cannot handle updates of the database.

We obtained the unmodified code from Python NLTK data package. The code is a rather large piece of Prolog text with some dead code which we commented out. Especially there were some fragments for adverb handling which was obviously dead ended and not included in the code that was available to use.

To our surprise some first testing showed that our code runs fine on our system and also on SWI-Prolog. But the demographical data seems a little out-dated. This is the result of starting chat80 via the predicate hi/0 and of running the command "do mini demo.".

Logic for Natural Language Analysis - Pereira, 1982
https://www.era.lib.ed.ac.uk/bitstream/handle/1842/6646/Pereira1982.pdf
Chat80 System as a Prolog Package
https://github.com/jburse/jekejeke-samples/tree/master/pack/language