Skip to main content

utilities for polyglots

Project description



polyquack is a utility (possibly part of a larger set in the future) for pluralizing words based on rules of varying complexity.

It has been inspired by the Localization and Plurals page from the MDN.


Simply run pip install polyquack.


First, define a list of forms. It is a simple dict with language codes as keys. For now, refer to the tests/ file to see the form definitions by rule, and the file for a mapping of languages to rules. Not all languages have the same number of forms (for instance, slavic languages often have a genitive plural form).

>>> song_forms = {
...     "en": ["song", "songs"],
...     "fr": ["chanson", "chansons"],
...     "pl": ["piosenka", "piosenki", "piosenek"],
... }

This package provides a handy Pluralizable class that you can use.

>>> from polyquack import pluralization
>>> song = pluralization.Pluralizable(forms=song_forms)
>>> print(f"4 {song.pluralize_by_language('pl', 4)}") # nominative plural
4 piosenki
>>> print(f"5 {song.pluralize_by_language('pl', 5)}") # genitive plural
5 piosenek


This project is barely a few days old. I will be adding proper documentation, and tox for testing.

Project details

Download files

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

Source Distribution

polyquack-0.1.1.tar.gz (5.7 kB view hashes)

Uploaded source

Built Distribution

polyquack-0.1.1-py3-none-any.whl (6.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page