Simple Prolog Tree ParserProf. Ray C.
The following diagram shows the screen contents (scriptfile) of what happens when you are using the Ultrix DECstation at NYU (acf2) to parse a simple string (the man sees in the house) using Quintus Prolog.
You can get essentially the same results on an IBM Windows PC using SWI-PROLOG and a Macintosh using OPEN PROLOG.
This particular program, called tree (ascii), here compressed tree.zip, must be downloaded and installed in the directory of your computer.
The install disk included with the book Natural Language Computing automatically sets up the directory c:/prolog2 and installs all programs. The program tree.pro is loaded by the disk, but it is called g09tree.pro. It will produce some part of the tree, then run out of memory and produce an error. If you have loaded Prolog2 from the distribution disk, simply load the program |?- ['g09tree.pro']. It will perform as in the diagrams on this site but not be able to finish the tree since it has a poor memory manager.
The program tree has a tiny lexicon and a simple set of combinatory principles. It is intended as a pedigogical tool for introductory classes intending to show how to encode Chomsky's ideas about generative grammar (particularly the merge operation) into Prolog.
/* Program Name: tree tree.pro tree.pl lexicon_09a */ /* You do not have to be a rocket scientist to see how to */ /* add words to this lexicon. If you add new elements, */ /* you will be able to parse more sentences. */ /* determiners */ det([the]). det([a]). det([this]). det([that]). /* prepositions */ prep([on]). prep([in]). prep([at]). prep([under]). prep([to]). /* nouns */ noun([house]). noun([table]). noun([man]). noun([woman]). /* verbs */ verb([sees]). verb([sits]). verb([looks]). verb([persuades]). verb([thinks]). verb([knows]). verb([puts]).