Writing a parser the right way?

beza1e1 andreas.zwinkau at googlemail.com
Thu Sep 22 19:27:28 CEST 2005

Thanks for the hints. I just found NLTK and MontyLingua.

And yes, it is just adventure game language. This means every tense
except present tense is discarded as "not changing world". Furthermore
the parser will make a lot of assumptions, which are perhaps 90% right,
not perfect:

if word[-2:] == "ly":
        return Adverb(word)

Note that uppercase words are identified before, so Willy is parsed
correctly as a noun. On the other hand "silly boy", will not return a
correct result.

Currently it is just a proof-of-concept. Maybe i can integrate a better
parser engine later. The idea is a kind of mud, where you talk correct
sentences instead of "go north". I envision a difference like Diablo to
Pen&Paper. I'd call it more a collaborative story telling game, than a
actual RPG.

I fed it your sentences, Paul. Result:
<['I', 'drive', 'a']> <['red']> <['truck']>
should be:
<['I']> <['drive']> <['a', 'red', 'truck']>

Verbs are the tricky part i think. There is no way to recognice them.
So i will have to get a database ... work to do. ;)

More information about the Python-list mailing list