jasona@sugar.hackercorp.com (Jason Asbahr) (01/28/91)
Greets! One night recently (having nothing better to do), I whipped up a simple term program to amaze and amuse my friends. It would simply pass characters between the console (Atari ST) and the modem...but with a little twist. Words (read as: strings bracketed by spaces) are taken from both modem and keyboard input and stored in an array (10,000). There was a random 1 in 10 chance that at every space typed by the friend at the other end of the modem connection, a word would be selected (also randomly) from the stored array and injected into the middle of his/her typing stream. :) The results were often quite funny, depending on the content of the conversation, etc. I find that the "game" would be a lot more fun if some kind of proper grammatical analysis was employed. I've thought about it a little, looking from something simple and fast...maybe referencing the "captured" words to a built in dictionary to assign noun/verb/adverb status and then only injecting words according to the previously typed word...so that verbs wouldn't be placed immediately after verbs ("ate ran")... Can anyone point me in the right direction? I would also like to hear from someone who has played with similar toys. I'm not sure that this has any practical purpose...but it might! -Jason Asbahr jasona@sugar.hackercorp.com "But truth is so great a thing that we must not disdain any medium that will lead us to it." - Montaigne --
hafner@corwin.CCS.Northeastern.EDU (carole hafner) (01/30/91)
"Language as a Cognitive Process, Vol. 1, Syntax" by Terry Winograd is an excellent reference including detailed algorithms for Eliza-like pattern-directed interaction, simple context free parsers, etc. It also shows how to build a lexicon and use it. The publisher is Addison-Wesley. The book uses a strange sort of pseudo-code which puts some people off, but it is a great source of information if you can get over that hurdle. --Carole Hafner
jacob@latcs1.oz.au (Jacob L. Cybulski) (02/07/91)
If you want to have fun with ELIZA-like program in prolog, here is a full implementation of it (actually my students were required to write it for the CL exam). Enjoy. Jacob L. Cybulski Amdahl Australian Intelligent Tools Programme Department of Computer Science La Trobe University Bundoora, Vic 3083, Australia Phone: +613 479 1270 Fax: +613 470 4915 Telex: AA 33143 EMail: jacob@latcs1.oz.au /* ToyEliza - by Jacob L. Cybulski */ unify([W | Rest], [[W | Phrase] | Pattern]) :- unify(Rest, [Phrase | Pattern]). unify(Words, [[] | Pattern]) :- unify(Words, Pattern). unify([], []). qa(InPhrase, OutPhrase) :- pattern(InPattern, OutPattern), unify(InPhrase, InPattern), unify(OutPhrase, OutPattern). /* Sample data base, probably you will have to disable "if" operator */ pattern([X, [alike], Y], [[in, what, way]]). pattern([X, [alike], Y], [[what, resemlance, do, you, see]]). pattern([X, [are, you], Y], [[would, you, prefer, it, if, i, were, not], Y]). pattern([X, [are], Y], [[what, if, they, were, not], Y]). pattern([X, [always], Y], [[can, you, think, of, a, specific, example]]). pattern([X, [always], Y], [[when]]). pattern([X, [always], Y], [[really, always]]). pattern([[what], X], [[why, do, you, ask]]). pattern([[what], X], [[does, that, interest, you]]). pattern([[my], X], [[your], X]). /* Possible questions and answers : 2?- qa([i, am, alike, you], A). A = [in, what, way] 3?- qa([they, are, stupid], A). A = [what, if, they, were, not, stupid] 4?- qa([why, are, you, so, nasty], A). A = [would, you, prefer, it, if, i, were, not, so, nasty] */