Newsgroups: rec.arts.int-fiction
Path: gmd.de!xlink.net!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!ames!olivea!news.bu.edu!noc.near.net!viewlog.viewlogic.com!allen
From: allen@viewlogic.com (Dave Allen)
Subject: Eliza string parsing
Message-ID: <CnDnyu.HDE@viewlogic.com>
Sender: news@viewlogic.com
Nntp-Posting-Host: hex
Organization: Viewlogic Systems Inc.
Date: Mon, 28 Mar 1994 13:54:28 GMT
Lines: 65

Phil Goetz (goetz@cs.buffalo.edu) wrote: 

> Here's my old-fashioned (functional) LISP code for Eliza.

Thanks!  I also got a 5-page BASIC implementation from Wes, and a 30-page
LISP version from Wes which appears to be part of GNU-Emacs.  I will
translate the BASIC one to TADS, eventually, and put it on the archive.

I wrote:
> What you want is to determine, in the preparser, whether the rest of the
> text will produce an error if parsed.
> What you could do instead is treat text in quotes as special.  Or maybe
> you could use a verb like SAY which takes up to the next period as a
> special string.

Phil replied:
> Here's what I did in _Inmate_:

Is that a TADS game?  I remember some other references you have made to
Inmate, but I can't recall if you are doing it in TADS.  The next couple
of things you mention are neat ... I'd like to ask for the TADS code, but
then I'm not sure what you are writing in.

> TELL could be used via the transformation
> 	TELL <person> QUOTE -> SAY QUOTE TO <person>
> NOTE:	Transformations are great!  How come no one else uses them?
> They let you do things like
> 	<transverb> <indirect obj> <obj> -> <transverb> <obj> TO <ind obj>

That's the first thing I'd like more info on, if done in TADS.

> Your command would be parsed and acted on.  The SAY verb handler
> would then pass the string in quotes to the parser, which would
> make the character spoken to go ahead and execute the command if it
> were such.

That's the second thing I'd like more info on, if done in TADS.

I have thought some more about implementing the string parser in TADS.

I don't think there is any way to tell in advance whether parsing a string
will succeed.  In fact, I don't think you can even tell whether all of the
words in a string are "defined" in TADS, ie, used in a NOUN, VERB or ADJECTIVE
statement.  Since you can define several synonyms in one NOUN statement,
you can't write a loop over all objects to find all the words.

Can any TADS expert suggest how to tell in "preparse" whether a string is a
valid command or not?  Or even how to make a reasonable guess about whether
is it a valid command or not?

It turns out that TADS provides a generic string object.  It will only take
a few lines of code to build a routine which will allow SAY "SOME TEXT" TO
BILL, or SAY "SOME TEXT".  The latter will fill in the actor if there is
only one present, ask you to disambiguate if more than one, or print some
worthwhile message if none are present.

However, you can't use the string object as a verb -- only as a noun.  So you
won't be able to write BILL, "SOME TEXT".  The parser will complain there's
no verb in the sentence.

Can any TADS expert suggest how to use strObj as a verb?  Or some other way
to allow the statement BILL, "HOW ARE YOU?"

Thanks in advance,
- Dave Allen: allen@viewlogic.com
