Architecture

See Figure 1 in An Architecture for More Realistic Conversational Systems, Allen, Ferguson, Stent (2001) for an example of how to design a good interactive system. We don't have all that stuff. Instead, we have the following main architecture.

The items in double lines are the ones we don't have. But we could have them. If it isn't on the diagram, we really don't have it.

Installation Instructions

Most of the stuff you'll need unzips right out of the tarball into working order. Check that you have a main directory, probably called speech, containing three subdirectories, docs, domain, and src. (If you worked on Tori's speech programs, this should look familiar, but not identical.)

There are a few tricky external items, however. First off, make sure you have Sphinx. If you don't, go to Sourceforge and download it, then follow the instructions to make it for your system. Now get a new project and put the c file mabelserver.c into the sphinx/src/examples (or sphinx/win32/msdev/examples) folder. Then hack the Makefile (or project files) until it compiles. Remember that mabelserver depends on srvcore.c/h. Now put the sphinx2-mabel-* scripts into scripts (or sphinx/win32/batch). Hack them until they point to the executable you just made out of mabelserver. Finally, decide whether you want to use atis phonesets. If you do, alter the scripts and put the atis phone and map files into the sphinx directory, I think in the sphinx/models/hmm folder, but I'm not sure. Then change the script to point to the atis hmms instead of the 6k hmms.

I've been using Sphinx dictionaries in Tori's old folder, ?/nlu/domains/scheduler. If you want to move them, go back and change the script or batch file again, this time to point to a new dictionary location. To compile a dictionary, you can use Tori's perl tools to go through the Bayesian training corpus, create a Sphinx corpus and save it to disk (look in ?/nlu/scripts). Then go to the CMU Sphinx website and use their free LM tool to compile it. See my Sphinx documentation for more on this.

Now check that you have a licensed copy of JIProlog. If you don't, bad things will happen. You should have a zipfile, Elsner.zip, which expands to two files, licence.me and abc.me, and these files should be in the src directory. If you have a JIProlog directory (which is useful for testing) put them there too. You can get JIProlog at www.ugosweb.com/jiprolog.

Now make sure you have java 1.4.1 (or better), and that you can use javac and java. You can get java from Sun. The program should work with java 1.x, but it isn't guaranteed. Go to src and javac *.java.

Finally, compile your lexicon into prolog. It's important to do this every time you add words to the lexicon, change parts of speech, or rewrite selectional code. You can rewrite interpretation code without doing this, though. To compile the lexicon, java DatabaseLexicon lexical file (lexical files) output file. For instance, you can use java DatabaseLexicon ../domain/core-lexicon ../domain/sched-lexicon ../domain/prolog-lexicon for the current lexical build files.

Name Allocation Problem

As the name allocation problem occurs in both the parser and the interpreter, it probably belongs here. Basically, the parser and interpreter use (separate) prolog databases containing information on the sentences they examine. Both of them add knowledge about the structure of each sentence to the database, using names of the form prefixXXX where XXX is a static integer. This means that every time a sentence is parsed or interpreted, the databases contain more information (mostly useless, or in the case of the parser, all useless), and more unique names are used up. It is conceivable that during a very long run, this could slow down the performance of Prolog, or even exhaust the 2^32 names of each type available.

This isn't the first thing to fix, but it is worth thinking about. Although retract and abolish might help somewhat, be careful of removing useful data (like the lexicon or utilities) from the database, destroying acquired knowledge (such as facts about user preferences), or leaving autogenerated rules in the database while removing facts. (In many cases, asserted code forms a rule of the type predicate(uniqueName, X):- otherPredicates(X, Y, Z). This code will not be removed by calls to retract, and will continue to affect the use of uniqueName.

Code Style

One final note on code style-- to find anywhere I think I have done something especially egregious, grep the word 'HACK', in all caps. This should find all the hacks.

Further Work

Not much needs to be done here.