Skip to main content

PyPI Codecov GitHub Workflow Status PyPI - Downloads

Why this project?

This repo is simply a Python port of https://github.com/blakeembrey/pluralize 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 https://github.com/blakeembrey/pluralize is the best one for me (most accurate), so ported it into the Python world.

Installation

pip install pluralizer

Usage

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

License

MIT

All credits to https://github.com/blakeembrey/pluralize.

Release files for pluralizer 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pluralizer 2.0.0
File Size Uploaded
pluralizer-2.0.0.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pluralizer 2.0.0
File Interpreter ABI Platform
pluralizer-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 21.3 kB

Release files / pluralizer-2.0.0.tar.gz

Download URL pluralizer-2.0.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3d48412c17397f52fb5b5485cbb5427b687d6e21daca0e65d9dfc16a989ec0c9
BLAKE2b-256 checksum
How to use checksums
77b3bf7fe8341d5eb6b86f9b99d0419efe431b83be105db4d70646138fbadd30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / pluralizer-2.0.0-py3-none-any.whl

Download URL pluralizer-2.0.0-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
282e536f989cc30eeb4db69b63539030b2e50f1c93d737b783a924fe486d8141
BLAKE2b-256 checksum
How to use checksums
8eefac208cfa9d708d246aca64192fca9bd6518618998c4efa8e765ceac34405
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page