Path Through the System

When the program starts up, the parser reads the files domain/grammar-2, domain/preprocessor, domain/core-lexicon, domain/sched-lexicon, domain/prolog-lexicon and domain/lexical-hierarchy. It uses the grammar to build a list of rules, and hands off the other files to subclasses. The preprocessor file goes to the preprocessor, the two lexicon files go to the lexicon, and the prolog lexicon and lexical hierarchy go to a prolog engine.

Text input to the parser enters in String form, either from the keyboard or via TCP.

It goes to the preprocessor, which converts it to lower case, then runs it through a series of regular expression replacements (written in Java), resulting in another String.

Next it goes to the parser, which looks up its words in the Lexicon (written in Java) and uses them to construct LexItems. These LexItems become parts of Arcs according to grammatical rules. When an Arc is complete, it uses Prolog to check itself for consistency, using selectional rules. If it is consistent, it derives a Phrase, which is a kind of Constituent.

When the parser is finished deriving constituents, it uses a function in the Parser class to select the correct constituent and return it. This return is a Constitutent object, which contains a list of other Constituents, in a hierarchically ordered structure.

When the program starts an interpreter, it reads the files domain/semantic-utils, domain/semantic-hierarchy, and domain/sched-domain, all of which go to a prolog engine (but not the same one as the parser uses).

The Constituent goes to the interpreter, which reads through the tree, pulling out the semantic information (written in Prolog and markup) that is contained at each node. It concatenates all this information into a big block of code. It then uses Java regular expressions to replace the markup contained in the code with valid Prolog code.

Once these replacements are made, the code goes to Prolog. The interpreter then makes a series of queries to classify the sentence as a command, question or statement. Finally, it takes the appropriate action, either getting an answer, believing a fact or just returning some kind of flag to discourse control.

The interface between the interpreter and discourse control doesn't exist yet. There is a fake interface in place, but it won't be at all useful.

Eventually, discourse control needs to send things to output devices, including Mabel's main control program.