[ANN] inflect.py: generate plurals, ordinals, numbers to words...

Paul pwdyson at yahoo.com
Thu Jul 15 13:00:53 CEST 2010

I'm pleased to announce the release of inflect.py v0.1.8, a module that correctly generates:

* the plural of singular nouns and verbs
* the singular of plural nouns
* ordinals
* indefinite articles
* present participles
* and converts numbers to words


>>> import inflect
>>> p = inflect.engine()
>>> p.pl('cat')
>>> p.pl('sheep')
>>> p.pl('bacterium')

plural of singular verbs: it walks -> they walk
>>> p.pl('walks')

singular of plural nouns:
>>> p.sinoun('bacteria')
>>> p.sinoun('knives')

>>> p.ordinal(31)
>>> p.ordinal('twenty-five')

indefinite articles:
>>> p.a('horse')
'a horse'
>>> p.a('ant')
'an ant'
>>> p.a('hour')
'an hour'

present participles:
>>> p.prespart('drinks')


>>> p.prespart('runs')
>>> p.prespart('flies')

numbers to words:
>>> p.numwords(1234567)
'one million, two hundred and thirty-four thousand, five hundred and sixty-seven'

Installation: "pip install inflect" or "easy_install inflect"
PyPi: http://pypi.python.org/pypi/inflect
Bug Tracker: http://github.com/pwdyson/inflect.py/issues
Source Code: http://github.com/pwdyson/inflect.py

Paul Dyson


More information about the Python-announce-list mailing list