pluralizer


Namepluralizer JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/weixu365/pluralizer-py
SummarySingularize or pluralize a given word useing a pre-defined list of rules
upload_time2022-06-07 09:35:55
maintainer
docs_urlNone
authorWei Xu
requires_python>=3.6
licenseMIT
keywords pluralize singularize singular plural
VCS
bugtrack_url
requirements coverage flake8 setuptools wheel twine commitizen
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI](https://img.shields.io/pypi/v/pluralizer?style=plastic)](https://pypi.org/project/pluralizer/)
[![Codecov](https://img.shields.io/codecov/c/github/weixu365/pluralizer-py?style=plastic)](https://codecov.io/gh/weixu365/pluralizer-py)
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/weixu365/pluralizer-py/Python%20package?style=plastic)](https://github.com/weixu365/pluralizer-py/actions?query=branch%3Amaster)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pluralizer?style=plastic)](https://pypistats.org/packages/pluralizer)

## 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.
- TextBlob: https://github.com/sloria/TextBlob
- inflect: https://github.com/jazzband/inflect
- NLTK Wordnet: https://www.nltk.org/howto/wordnet.html


## Installation
```bash
pip install pluralizer
```

## Usage
```python
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. 



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/weixu365/pluralizer-py",
    "name": "pluralizer",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "pluralize,singularize,singular,plural",
    "author": "Wei Xu",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c4/11/5e3e7af16fe46612265e6cfed0f1c8f49fb0cdb424d314154d5a3b364bac/pluralizer-1.2.0.tar.gz",
    "platform": "any",
    "description": "[![PyPI](https://img.shields.io/pypi/v/pluralizer?style=plastic)](https://pypi.org/project/pluralizer/)\n[![Codecov](https://img.shields.io/codecov/c/github/weixu365/pluralizer-py?style=plastic)](https://codecov.io/gh/weixu365/pluralizer-py)\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/weixu365/pluralizer-py/Python%20package?style=plastic)](https://github.com/weixu365/pluralizer-py/actions?query=branch%3Amaster)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pluralizer?style=plastic)](https://pypistats.org/packages/pluralizer)\n\n## Why this project?\nThis 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.\n\n> 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.\n\nI 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.\n- TextBlob: https://github.com/sloria/TextBlob\n- inflect: https://github.com/jazzband/inflect\n- NLTK Wordnet: https://www.nltk.org/howto/wordnet.html\n\n\n## Installation\n```bash\npip install pluralizer\n```\n\n## Usage\n```python\nfrom pluralizer import Pluralizer\n\npluralizer = Pluralizer()\n\nassert pluralizer.pluralize('apple', 1, False) == 'apple'\nassert pluralizer.pluralize('apple', 1, True) == '1 apple'\nassert pluralizer.pluralize('apple', 2, False) == 'apples'\nassert pluralizer.pluralize('apple', 2, True) == '2 apples'\n\nassert pluralizer.plural('apple') == 'apples'\nassert pluralizer.singular('apples') == 'apple'\n\nassert pluralizer.isPlural('apples') == True\nassert pluralizer.isPlural('apple') == False\nassert pluralizer.isSingular('apples') == False\nassert pluralizer.isSingular('apple') == True\n```\n\n## License\nMIT\n\nAll credits to https://github.com/blakeembrey/pluralize. \n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Singularize or pluralize a given word useing a pre-defined list of rules",
    "version": "1.2.0",
    "project_urls": {
        "Homepage": "https://github.com/weixu365/pluralizer-py"
    },
    "split_keywords": [
        "pluralize",
        "singularize",
        "singular",
        "plural"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "682c3e2dd10df7fffa916ceba9eef10f7e90d22cf90acec269914bb63081b1aa",
                "md5": "cabeca1e6cc3eb39e293d45bd7fddc90",
                "sha256": "d8f92ffa787661d9e704d1e0d8abc6c6c4bbaae9e790d7c709707eafbe17ed12"
            },
            "downloads": -1,
            "filename": "pluralizer-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cabeca1e6cc3eb39e293d45bd7fddc90",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7632,
            "upload_time": "2022-06-07T09:35:54",
            "upload_time_iso_8601": "2022-06-07T09:35:54.457113Z",
            "url": "https://files.pythonhosted.org/packages/68/2c/3e2dd10df7fffa916ceba9eef10f7e90d22cf90acec269914bb63081b1aa/pluralizer-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c4115e3e7af16fe46612265e6cfed0f1c8f49fb0cdb424d314154d5a3b364bac",
                "md5": "e3d7ec9784a66f31bb983d04a504993c",
                "sha256": "fe3fb8e1e53fabf372e77d8cbebe04b0f8fc7db853aeff50095dbd5628ac39c5"
            },
            "downloads": -1,
            "filename": "pluralizer-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e3d7ec9784a66f31bb983d04a504993c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6879,
            "upload_time": "2022-06-07T09:35:55",
            "upload_time_iso_8601": "2022-06-07T09:35:55.835718Z",
            "url": "https://files.pythonhosted.org/packages/c4/11/5e3e7af16fe46612265e6cfed0f1c8f49fb0cdb424d314154d5a3b364bac/pluralizer-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-07 09:35:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "weixu365",
    "github_project": "pluralizer-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "coverage",
            "specs": [
                [
                    ">=",
                    "7.1.0"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    ">=",
                    "5.0.4"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "66.1.1"
                ]
            ]
        },
        {
            "name": "wheel",
            "specs": [
                [
                    ">=",
                    "0.37.1"
                ]
            ]
        },
        {
            "name": "twine",
            "specs": [
                [
                    ">=",
                    "4.0.2"
                ]
            ]
        },
        {
            "name": "commitizen",
            "specs": [
                [
                    ">=",
                    "2.40.0"
                ]
            ]
        }
    ],
    "lcname": "pluralizer"
}
        
Elapsed time: 0.16171s