"""Pluralize English nouns (stage 6)This program is part of "Dive Into Python", a free Python book forexperienced programmers. Visit http://diveintopython.org/ for thelatest version.Command line usage:$ python plural6.py nounnouns"""__author__="Mark Pilgrim (mark@diveintopython.org)"__version__="$Revision: 1.2 $"__date__="$Date: 2004/03/25 15:51:13 $"__copyright__="Copyright (c) 2004 Mark Pilgrim"__license__="Python"importredefrules(language):forlineinfile('rules.%s'%language):pattern,search,replace=line.split()yieldlambdaword:re.search(pattern,word)andre.sub(search,replace,word)defplural(noun,language='en'):forruleinrules(language):result=rule(noun)ifresult:returnresultif__name__=='__main__':importsysifsys.argv[1:]:printplural(sys.argv[1])else:print__doc__