in reply to Parsing english

Can you be more specific on what your little game is going to parse? Is it going to parse a set of strictly defined phrases in a specific order? Or is it going to parse what the players type in (like the old sierra advanture games)? Because the second type of text is much harder to parse.

You can checkout the Parse::RecDescent module from CPAN if you decided to build it upon a set of strictly defined grammar.

And in the second case, the simplest would be to grep for recognised words in the tokenised text. And then act upon the recognised words. Otherwise you would end up with the task of writing a natual language parser with functional dependent grammar... (Good for a PhD thesis perhaps?)

Replies are listed 'Best First'.
Re: Re: Parsing english
by wolis (Scribe) on Oct 07, 2003 at 07:28 UTC
    Yes, I aspire for the latter.

    However I do assume the sentences being typed in would match a logical structure so:

    Create some sticks Create a pile of wooden sticks Create a great big pile of burning wooden sticks Create a small bundle of red sticks of dynamite Create a stick of dynamite
    All these would (and currently do) work in my parser. However I am working within the confines of creating objects so 'sticks are to be created that are made of wood and grouped into a pile' is outside my 'world view' :-) and ignoerd.. or accuratly 'said' to the other players not acted upon like a 'create' command.

    And yes you guessed it:

    Create a small white rabbit Put the rabbit on the sticks Put the dynamite on the rabbit etc..
    Will also logically be parsed and 'work' so players will see 'a pile of sicks with a small white rabbit on it. On the rabbit is a small bundle of red sticks of dynamite' etc..

    ___ /\__\ "What is the world coming to?" \/__/ www.wolispace.com