[MUD-Dev] Text Parsing

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Fri May 28 19:08:49 CEST 1999


[Kylotan, in response to Albert:]

> How can you tell, out of context, whether a noun is the direct object or the
> indirect object? (eg. in "get the bag" and "put the ball in the bag" the
> word "bag" is direct in the first instance, and indirect in the second.) I
> would think you'd need to be looking for other clues, such as
> prepositions/prepositional phrases to indicate that you are now expecting an
> indirect object.

That's pretty much what I was going to say, too. A given word can play
lots of different roles in English. E.g.

    bag the groceries
    take the bag
    take the eggs from the bag
    put the sausage into the bag
    put the bag down
    put down the bag
    down

with the classic, of course being:

    time flies like an arrow


Anyway, my solution to this is to have the form of a verb stored with
every word that can be a verb. There can be multiple uses of the same
verb, so long as there is a preposition that distinguishes them. E.g.,
the above are examples of the forms:

    BAG <noun-phrase>...
    TAKE <noun-phrase>...
    TAKE <noun-phrase>... FROM <noun-phrase>
    PUT <noun-phrase>... INTO <noun-phrase>
    PUT <noun-phrase>... DOWN	===   PUT DOWN <noun-phrase>...
    DOWN

I don't record all nouns and adjectives at all. A <noun-phrase> is just
one or more words (skipping an optional 'a', 'an', 'the') that ends
with something that is important to the verb, or at the end of the command.
The last word is the noun, and the rest are considered to be adjectives.
There are some cases this doesn't handle, but it gets quite a few.

--
Don't design inefficiency in - it'll happen in the implementation.

Chris Gray     cg at ami-cg.GraySage.Edmonton.AB.CA
               http://www.GraySage.Edmonton.AB.CA/cg/


_______________________________________________
MUD-Dev maillist  -  MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev




More information about the mud-dev-archive mailing list