Skip to main content

Singularize or pluralize a given word useing a pre-defined list of rules

Project description

PyPI Codecov GitHub Workflow Status PyPI - Downloads

Why this project?

This repo is simply a Python port of which has > 1.4m github usages and 3.5 million downloads per week when I evaluating different libraries.

This module uses a pre-defined list of rules, applied in order, to singularize or pluralize a given word. There are many cases where this is useful, such as any automation based on user input. For applications where the word(s) are known ahead of time, you can use a simple ternary (or function) which would be a much lighter alternative.

I have compared the following alternatives, and found is the best one for me (most accurate), so ported it into Python world.


pip install pluralizer


from pluralizer import Pluralizer

pluralizer = Pluralizer()

assert pluralizer.pluralize('apple', 1, False) == 'apple'
assert pluralizer.pluralize('apple', 1, True) == '1 apple'
assert pluralizer.pluralize('apple', 2, False) == 'apples'
assert pluralizer.pluralize('apple', 2, True) == '2 apples'

assert pluralizer.plural('apple') == 'apples'
assert pluralizer.singular('apples') == 'apple'

assert pluralizer.isPlural('apples') == True
assert pluralizer.isPlural('apple') == False
assert pluralizer.isSingular('apples') == False
assert pluralizer.isSingular('apple') == True



All credits to

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pluralizer, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size pluralizer-1.1.0-py3-none-any.whl (7.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pluralizer-1.1.0.tar.gz (6.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page