Metadata-Version: 2.1
Name: polyquack
Version: 0.2.0
Summary: utilities for polyglots
Home-page: https://gitlab.com/patryk-media/polyquack
License: BSD-3-Clause
Keywords: polyglot,i18n,pluralization
Author: Patryk Bratkowski
Author-email: git@patryk.tech
Requires-Python: >=3.6,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Communications
Classifier: Topic :: Software Development :: Internationalization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Linguistic
Project-URL: Repository, https://gitlab.com/patryk-media/polyquack
Description-Content-Type: text/markdown

# polyquack

## Preamble

`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](https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals) from the MDN.

## Installation

Simply run `pip install polyquack`.

## Usage

First, define a list of forms. It is a simple `dict` with language codes as keys. For now, refer to the `tests/test_pluralization.py` file to see the form definitions by rule, and the `rules.py` 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

## Todo

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