New issue 22 by hello.jay.araujo: Allow for phrasal verbs on command names
http://code.google.com/p/sorrows-mudlib/issues/detail?id=22
> pickup chest
User jay sees message: You pickup chest
Other user sees message: Jay pickups chest
Ideal: Jay picks up a chest
## Here's some related code from BogBoa:
def article(noun):
"""Return 'a' or 'an' depending on subject."""
if not noun:
return ''
nl = noun.lower()
if nl.startswith('uni'):
art = 'a'
elif nl.startswith('one'):
art = 'a'
elif nl.startswith('use'):
art = 'a'
elif nl.startswith('hon'):
art = 'a'
elif nl[0] in _VOWELS:
art = 'an'
else:
art = 'a'
return art
## and I expanded it with this:
def qtfy(obj):
name = obj.name.lower()
if obj.countable:
return '%s %s' % (article(name), name)
else:
return 'some %s' % name
Ah, right, I never did article support. This seems like something that
test driven development would be ideal for.
Comment #3 on issue 22 by richard.m.tew: Allow for phrasal verbs on command
names
http://code.google.com/p/sorrows-mudlib/issues/detail?id=22
(No comment was entered for this change.)
Comment #4 on issue 22 by richard.m.tew: Allow for phrasal verbs on command
names
http://code.google.com/p/sorrows-mudlib/issues/detail?id=22
I hope there's a library out there which takes care of this sort of thing,
which can either be used in-situ, or wrapped. Here's one that might be
worth looking at.
http://pypi.python.org/pypi/inflect/0.2.1
Comment #5 on issue 22 by richard.m.tew: Allow for phrasal verbs on command
names
http://code.google.com/p/sorrows-mudlib/issues/detail?id=22
Added simplistic article support.
http://code.google.com/p/sorrows-mudlib/source/detail?r=200
This should be sufficient, but there are gaps. Taking "pants" will be seen
by a bystander as "X takes a pants" and by the actor as "You take the
pants". The correct fix here would to add the concept of measure words as
descriptive adjectives so that any objects of type pants would inherit and
use the "pair" measure word. So taking "pants" will be seen by a bystander
as "X takes a pair of pants" and by the actor as "You take the pair of
pants".