[PAWS] Stump That Parser!

195 views
Skip to first unread message

wo...@one.net

unread,
Apr 18, 2001, 9:08:09 PM4/18/01
to

Now that PAWS 1.0 is out the door and I don't have to worry about "the
whole thing" anymore, I want to make improvements to various PAWS
areas, one or two per upgrade release.

I've decided that in PAWS 1.1 I'm going to concentrate on improving
the parser. While the current parser is adequate, it has a number of
shortcomings, such as the inability to use the same word as both
adjective and noun, the inability to handle numbers and quoted strings
and to handle "commodity" objects (Take 5 coins).

Obviously I want to make the PAWS parser the best available. To do
that I need people to post "parser stumpers", commands that are
difficult for parsers to handle correctly.

For example:

Drink the drink

Drink the drink and some water and then water the pot plant in the pot

Take everything except the widget

That sort of thing. :)

Also, from PAWs users I'd like to hear about parser shortcomings that
are cramping your style and what you'd like to see done about them.


Respectfully,

Wolf

"The world is my home, it's just that some rooms are draftier than
others". -- Wolf

Kevin Forchione

unread,
Apr 18, 2001, 9:39:02 PM4/18/01
to
<wo...@one.net> wrote in message
news:kvdsdt88fqavt0gru...@4ax.com...

>
> Now that PAWS 1.0 is out the door and I don't have to worry about "the
> whole thing" anymore, I want to make improvements to various PAWS
> areas, one or two per upgrade release.
>
> I've decided that in PAWS 1.1 I'm going to concentrate on improving
> the parser. While the current parser is adequate, it has a number of
> shortcomings, such as the inability to use the same word as both
> adjective and noun, the inability to handle numbers and quoted strings
> and to handle "commodity" objects (Take 5 coins).
>
> Obviously I want to make the PAWS parser the best available. To do
> that I need people to post "parser stumpers", commands that are
> difficult for parsers to handle correctly.

Off the top of my head, besides those that are currently problematical to
PAWS:

<<take any of his coins except the tarnished ones.>>
<<take the blue and gold banner.>>
<<put the box on the shelf in the basket.>>
<<wait until 5:00 p.m.>>
<<wait for 1 hour and 20 minutes>>
<<x the steel drawer of the wooden desk>>
<<x the wooden drawer of the steel desk>>

That's a good start.

--Kevin


SteveG

unread,
Apr 21, 2001, 5:07:33 PM4/21/01
to
On Wed, 18 Apr 2001 21:08:09 -0400, wo...@one.net wrote:
[snip]

>Obviously I want to make the PAWS parser the best available. To do
>that I need people to post "parser stumpers", commands that are
>difficult for parsers to handle correctly.

Can PAWS handle apostrophes? Such as

take Fred's hat

Can it handle commanding NPCs with the traditional "<name>, <command>"
syntax? eg:

Mary, take the lamb outside

[snip]
-- SteveG
remove _X_ from my address to send me email

wo...@one.net

unread,
Apr 21, 2001, 8:28:10 PM4/21/01
to

Hi SteveG,

>Can PAWS handle apostrophes? Such as
>
> take Fred's hat
>
>Can it handle commanding NPCs with the traditional "<name>, <command>"
>syntax? eg:
>
> Mary, take the lamb outside

Yes to both questions. In the case of Fred's hat, "Fred's" would be
defined as an adjective of hat.

NPC commands currently can ONLY be handled with the "<name>,
<command>" format.

Jonadab the Unsightly One

unread,
Apr 28, 2001, 6:12:09 PM4/28/01
to
wo...@one.net wrote:

> Obviously I want to make the PAWS parser the best available. To do
> that I need people to post "parser stumpers", commands that are
> difficult for parsers to handle correctly.

Tell Mary to ask Fred about his dog.
Ask Bob to let the cat out of the bag.
Bob, what seems to be the problem?
What is a grue?
Dealer, hit me.
Hit me, dealer.
Physician, heal yourself.
Brat, go away.
Leave, brat.
Turn down the off ramp.
Examine the wood.
Examine the stack of wood.
Examine the table.
Examine the wood table.
Examine the table cloth.
Examine the cloth on the table.
Take the cloth on the table.
Take the cloth off the table.
Open the box on the table.
Cut that strapping tape on the cardboard shipping box on the
kitchen table with those scissors from the drawer.
Little girl, put those scissors down!
Take the scissors from the girl.
Chase the girl who has the scissors.
Chase the girl with the scissors.
Chase the girl and Take the scissors away.
Chase the dog with the scissors.
Chase the dog under the table.
Look at the dog under the table.
Kick the dog under the table.
Nice doggy.
Bob, call off your dog!
Put the scissors back.

There're more where those came from.

- jonadab

wo...@one.net

unread,
Apr 28, 2001, 9:52:06 PM4/28/01
to

Hi Jonadab,

My first response: "Yes, the new parser I'm going to create will
handle all these without cheap tricks". :)

My second response: "Here's a list of workarounds and parser tricks
that will let you do a lot of these using the current parser".

-------------------------

The following are already supported by the current PAWS cursor
(explanations follow each case):

>Dealer, hit me.

A standard <subject>, <verb>, <direct object>. Of course you would
want to make the Dealer's Hit action non-combat related! :)

>Physician, heal yourself.

Make "yourself" a noun for physician. I know, I know, a cheesy
solution. But it does work. :)

>Brat, go away.

Standard <subject>, <verb>, <prepositon>. You'd have to create a
VerbGoAway and a GoAway method for objects, but it follows the
standard pattern.

>Take the cloth off the table.

Standard <verb> <direct object> <prepostion> <indirect object>. Of
course "cloth" would have to be a noun, not an adjective and table
would likewise have to be a noun.

>Chase the dog with the scissors.

To the *parser* this would appear to be <verb> <direct object>
<preposition> <indirect object>. Since it's very unlikely the dog will
possess scissors (though not entirely impossible) this is just like
the command "kill dog with scissors" except the end result (hopefully)
will be the dog leaving unhurt.

>Put the scissors back.

Standard <verb> <direct object> <preposition> Verb created would
probably be VerbPutBack.

>Bob, call off your dog!

Standard <subject>, <verb> <preposition> <direct object>. Just make
sure to make "your" an adjective of "dog". The author would have to
create a new verb probably called VerbCallOff.

>Take the scissors from the girl.

Standard <verb> <direct object> <preposition> <indirect object>. The
author would have to create a verb called VerbTakeFrom or somesuch.

>What is a grue?

Parser trick: Make "what" a *verb*, and "is" a *preposition*. Thus
this becomes a standard <verb> <preposition> <direct object> Author
created verb would be VerbWhatIs. A similar trick works for "Who is".

>Open the box on the table.

Standard <verb> <direct object> <preposition> <indirect object>,
author supplied verb OpenOn. The box would have an OpenOn method which
could respond appropriately. A bit of ingenuity could make this
solution generic.

>Take the cloth on the table.

Same as above.

>Kick the dog under the table.

Same as above, except you'd have to distinguish between "kick the dog
who is located under the table" and "kick the dog so it ends up under
the table".

>Nice doggy.

Parser trick, make "nice" a *verb*. There's no problem making a
vocabulary word both verb and adjective, the prohibition is only
against the same word as noun and adjective.

>Look at the dog under the table.

This might not work, but define a verb VerbLookAtUnder, give it
prepositions of "at" and "under". I'm not sure if the dog and table
would end up as direct or indirect objects. Let me know how this one
works! :)

>Chase the dog under the table.

Standard <verb> <direct object> <preposition> <indirect object>.
Author supplied verb would probably be called VerbChaseUnder.
(Assuming the intention is to have the dog end up under the table).

>Little girl, put those scissors down!

Standard <subject> <verb> <direct object> <preposition> The only trick
is adding "those" to the articles list with this code in your user
defined game setup function (such as TQUserSetupGame() in Thief's
Quest):

if "those" not in Global.ArticlesList:
Global.ArticlesList.append("those")

This code will survive game restarts.

>Chase the girl with the scissors.

Similar to "chase dog with scissors" except the ChaseWith action in
the girl should check to see if she has scissors, and if so call
VerbChase instead. If she doesn't then it's identical to the dog
example. This could be made generic through an actor foundation class.
Set the MaxBulk and/or MaxWeight property(s) of actors that can't
carry anything to 0 (which you should already have anyway) and use
that to test for object possession potential.

>Chase the girl who has the scissors.

Cheesy trick, define the adjectives for "girl" to include
"who,has,scissors". :) Hey, it works! {laughing}

>Examine the cloth on the table.

Standard <verb> <direct object> <preposition> <indirect object>.
Author created verb: VerbExamineOn.

>Examine the stack of wood.

Cheap trick, include "stack,of" in "wood"'s adjective list.

-------------------------

The following are supported, but not together in the same game:

>Examine the wood.
>Examine the wood table.

Can't do it, sorry. But you might consider "wooden" instead of "wood"
as a work around. The word "wood" in this case would work as a synonym
for "forest".

Note you will get a fairly strange response if a) your game included
both a wood and a table and b) the player had seen both the wood and
the table. The parser would interpret this as "examine the wood AND
the table" (with wood being forest).

>Examine the table.
>Examine the table cloth.

This one won't work either (same as above) but the workaround would be
to use "tablecloth" instead of "table cloth".

-------------------------

The following can't be supported by the current PAWS parser:

>Bob, what seems to be the problem?

This might work if you defined "what" as a verb and "seems,to,be" as
the prepositions of "what". Then it's just a standard <verb>
<preposition(s)> <direct object> Alternately you could try modifying
the PreParse() method.

>Hit me, dealer.

This would be interpreted as "hit me AND dealer". If you made "hit"
able to handle multiple direct objects (trivial) then played with the
Hit method in dealer and the player object you could make this work.

>Turn down the off ramp.

The parser interprets this as "turn down off ramp" which you could
make work by having a VerbTurnDownOff, making this just another
standard <verb> <preposition(s)> <direct object>.


>Leave, brat.

You could modify the PreParse() method, or have the leave method of
brat check to see if it's the only direct object. Of course making
this a generic solution would be problematic, but as a "one off" it
would work.

>Chase the girl and Take the scissors away.

if worded "Chase the girl THEN take the scissors away" it would work.
As worded, the current cursor would interpret this as "chase girl AND
scissors". In other words, chase the girl and chase the scissors. This
one really does stump the current parser. :)

----------------------------------

You have got to be kidding. All I can say is Egads! :)


>Tell Mary to ask Fred about his dog.
>Ask Bob to let the cat out of the bag.

>Cut that strapping tape on the cardboard shipping box on the
> kitchen table with those scissors from the drawer.

Greg Ewing

unread,
Apr 30, 2001, 11:20:08 PM4/30/01
to
wo...@one.net wrote:
>
> >Nice doggy.
>
> Parser trick, make "nice" a *verb*.

] NICE DOGGY
Okay, the dog's priority is now lower.

:-)

--
Greg Ewing, Computer Science Dept, University of Canterbury,
Christchurch, New Zealand
To get my email address, please visit my web page:
http://www.cosc.canterbury.ac.nz/~greg

Magnus Olsson

unread,
May 3, 2001, 5:12:41 AM5/3/01
to
In article <3AEE2B68...@my.signature>,

Greg Ewing <s...@my.signature> wrote:
>wo...@one.net wrote:
>>
>> >Nice doggy.
>>
>> Parser trick, make "nice" a *verb*.
>
>] NICE DOGGY
>Okay, the dog's priority is now lower.

Or why not

] nice doggy &

Spot is now running in the background. See Spot run.

(Sorry if this is incomprehensible to non-Unix types).


--
Magnus Olsson (m...@df.lth.se, m...@pobox.com)
------ http://www.pobox.com/~mol ------

Starweaver

unread,
May 3, 2001, 5:56:23 AM5/3/01
to
m...@pobox.com (Magnus Olsson) wrote in <9cr7e9$mi5$1...@news.lth.se>:

>In article <3AEE2B68...@my.signature>,
>Greg Ewing <s...@my.signature> wrote:
>> wo...@one.net wrote:
>>>
>>>> Nice doggy.
>>>
>>> Parser trick, make "nice" a *verb*.
>>
>>> NICE DOGGY
>> Okay, the dog's priority is now lower.
>
>Or why not
>
>] nice doggy &
>
>Spot is now running in the background. See Spot run.
>
>(Sorry if this is incomprehensible to non-Unix types).

$ cat scare | nice doggy --fetch | grep 'fighting' > /dev/outside &
??
Still not as groan as that 'c:\dos, c:\dos\run, run\dos\run'...

--
"Ronin Angel" Starweaver (RASX)
"$cat world | grep 'neuclear weapon' -i > world &"
www.rubydragon.com

David Given

unread,
May 3, 2001, 8:17:10 AM5/3/01
to
In article <Xns90961DAB34DB...@63.192.42.254>,
st...@pacbell.net (Starweaver) writes:
[...]

> Still not as groan as that 'c:\dos, c:\dos\run, run\dos\run'...

Must... resist... temptation... to... sig...

Any idea who coined this?

--
+- David Given --------McQ-+ "I told you to make one longer than another, and
| Work: d...@tao-group.com | instead you have made one shorter than the other --
| Play: d...@cowlark.com | the opposite." --- Sir Boyle Roche
+- http://www.cowlark.com -+

Jonadab the Unsightly One

unread,
May 18, 2001, 11:28:49 AM5/18/01
to
wo...@one.net wrote:

> >Examine the wood.
> >Examine the wood table.
>
> Can't do it, sorry.

I knew if I rattled off enough different kinds of
situations I'd hit one you hadn't handled yet.
BTW, in Inform this requires a parse_name routine
for the table.

> But you might consider "wooden" instead of "wood"
> as a work around.

Problem is, even if the game says "There is a wooden
table here", players will still type "x the wood
table", particularly if there's a metal table in
the game, too.

> >Chase the girl and Take the scissors away.
>
> if worded "Chase the girl THEN take the scissors away" it would work.
> As worded, the current cursor would interpret this as "chase girl AND
> scissors". In other words, chase the girl and chase the scissors. This
> one really does stump the current parser. :)

Even with the verb "take" in there?


- jonadab

Kevin Forchione

unread,
May 18, 2001, 12:39:29 PM5/18/01
to
"Jonadab the Unsightly One" <jon...@bright.net> wrote in message
news:3b053e60...@news.bright.net...

> wo...@one.net wrote:
>
> > >Chase the girl and Take the scissors away.
> >
> > if worded "Chase the girl THEN take the scissors away" it would work.
> > As worded, the current cursor would interpret this as "chase girl AND
> > scissors". In other words, chase the girl and chase the scissors. This
> > one really does stump the current parser. :)
>
> Even with the verb "take" in there?

Yep. If you check out the code for parsing noun phrases it trundles along
through the command and only examines adjectives and nouns. "And" is only
used to separate noun phrases, not commands, so the system assumes that
whatever comes after "and" is a noun phrase.

--Kevin


Reply all
Reply to author
Forward
0 new messages