friendlywords


Namefriendlywords JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttps://github.com/the-lay/py-friendly-words
SummaryPython package to generate random human-readable strings, e.g. project and experiment names
upload_time2024-03-19 15:41:14
maintainer
docs_urlNone
authorthe-lay
requires_python>=3.6
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # py-friendly-words
[![PyPI version](https://badge.fury.io/py/friendlywords.svg)](https://badge.fury.io/py/friendlywords)
![PyPI - Downloads](https://img.shields.io/pypi/dm/friendlywords)
[![Tests](https://github.com/the-lay/py-friendly-words/actions/workflows/test.yml/badge.svg)](https://github.com/the-lay/py-friendly-words/actions/workflows/test.yml)

Python package to generate random human-readable strings, e.g. project and experiment names.
The word lists are taken from
[glitchdomcom/friendly-words](https://github.com/glitchdotcom/friendly-words) and the package provides
a convenient way to access it, as well as methods to easily generate combinations.

The package is simple, limited, and over-engineered at the same time.
In other words, a weekend night side project.
If you need a stable package with more extensive customization, uniqueness guarantees,
bigger and/or custom dictionaries, check out
[alexanderlukanin13/coolname](https://github.com/alexanderlukanin13/coolname).

Features
--------
- No extra dependencies
- Optional preloading to avoid re-reading word list files
- Customizable generation (see the examples below)
- Custom separators
- Can return as a list of words

Quick guide
-----------
Install with PIP: `pip install friendlywords`

```python
import friendlywords as fw

# optional preloading, load all word lists into memory (~41KB)
# otherwise every generation would involve reading the files
fw.preload()

# generate random string that consists of N words (N > 0)
# if N is 1, the returned word is an object
# if N > 1, the first N-1 words are predicates
fw.generate(1)
>>> 'square'
fw.generate(4)
>>> 'southern florentine rain college'

# generate string that consists of a random predicate and random object
# p = predicate, o = object, t = team, c = collection
fw.generate('po')
>>> 'bittersweet curio'
fw.generate('pt')
>>> 'wood organization'
fw.generate('co')
>>> 'selection title'

# specify the separator
fw.generate('po', separator='-')
>>> 'better-tabletop'
fw.generate('ppp', separator=', ')
>>> 'elegant, skitter, sunny'
fw.generate(3, separator='/')
>>> 'winter/alkaline/handsaw' 

# return list of words instead of a string (ignores separator keyword)
fw.generate(5, as_list=True)
>>> ['laced', 'polyester', 'ossified', 'cyclic', 'chronometer']
fw.generate('pppoc', as_list=True)
>>> ['able', 'splendid', 'harvest', 'hedge', 'playlist']

# lists of all predicates, objects, teams or collections
fw.predicates, fw.objects, fw.teams, fw.collections
>>> ['windy', ...], ['turnip', ...], ['alliance', ...], ['album', ...]
```

Notes
-----
- You could make it reproducible by setting the `random.seed()`.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/the-lay/py-friendly-words",
    "name": "friendlywords",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "the-lay",
    "author_email": "ilja.gubin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0b/cc/0236704916a4cff8a4766c2d4ee7451eecdfa1bb198df3317f90f77793ed/friendlywords-1.1.3.tar.gz",
    "platform": null,
    "description": "# py-friendly-words\n[![PyPI version](https://badge.fury.io/py/friendlywords.svg)](https://badge.fury.io/py/friendlywords)\n![PyPI - Downloads](https://img.shields.io/pypi/dm/friendlywords)\n[![Tests](https://github.com/the-lay/py-friendly-words/actions/workflows/test.yml/badge.svg)](https://github.com/the-lay/py-friendly-words/actions/workflows/test.yml)\n\nPython package to generate random human-readable strings, e.g. project and experiment names.\nThe word lists are taken from\n[glitchdomcom/friendly-words](https://github.com/glitchdotcom/friendly-words) and the package provides\na convenient way to access it, as well as methods to easily generate combinations.\n\nThe package is simple, limited, and over-engineered at the same time.\nIn other words, a weekend night side project.\nIf you need a stable package with more extensive customization, uniqueness guarantees,\nbigger and/or custom dictionaries, check out\n[alexanderlukanin13/coolname](https://github.com/alexanderlukanin13/coolname).\n\nFeatures\n--------\n- No extra dependencies\n- Optional preloading to avoid re-reading word list files\n- Customizable generation (see the examples below)\n- Custom separators\n- Can return as a list of words\n\nQuick guide\n-----------\nInstall with PIP: `pip install friendlywords`\n\n```python\nimport friendlywords as fw\n\n# optional preloading, load all word lists into memory (~41KB)\n# otherwise every generation would involve reading the files\nfw.preload()\n\n# generate random string that consists of N words (N > 0)\n# if N is 1, the returned word is an object\n# if N > 1, the first N-1 words are predicates\nfw.generate(1)\n>>> 'square'\nfw.generate(4)\n>>> 'southern florentine rain college'\n\n# generate string that consists of a random predicate and random object\n# p = predicate, o = object, t = team, c = collection\nfw.generate('po')\n>>> 'bittersweet curio'\nfw.generate('pt')\n>>> 'wood organization'\nfw.generate('co')\n>>> 'selection title'\n\n# specify the separator\nfw.generate('po', separator='-')\n>>> 'better-tabletop'\nfw.generate('ppp', separator=', ')\n>>> 'elegant, skitter, sunny'\nfw.generate(3, separator='/')\n>>> 'winter/alkaline/handsaw' \n\n# return list of words instead of a string (ignores separator keyword)\nfw.generate(5, as_list=True)\n>>> ['laced', 'polyester', 'ossified', 'cyclic', 'chronometer']\nfw.generate('pppoc', as_list=True)\n>>> ['able', 'splendid', 'harvest', 'hedge', 'playlist']\n\n# lists of all predicates, objects, teams or collections\nfw.predicates, fw.objects, fw.teams, fw.collections\n>>> ['windy', ...], ['turnip', ...], ['alliance', ...], ['album', ...]\n```\n\nNotes\n-----\n- You could make it reproducible by setting the `random.seed()`.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python package to generate random human-readable strings, e.g. project and experiment names",
    "version": "1.1.3",
    "project_urls": {
        "Homepage": "https://github.com/the-lay/py-friendly-words",
        "Issues": "https://github.com/the-lay/py-friendly-words/issues",
        "Source": "https://github.com/the-lay/py-friendly-words"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6af28cfd5843c295073ad8fa6f60a596204d0ed8fe8f1812a5ea8e3c71cf1c03",
                "md5": "48a635e97e87cbb1fe607d79bac31441",
                "sha256": "747dd2bd674dbf6a328bab6604cfd006c0b6b953adc12ba903a0e08fa0528639"
            },
            "downloads": -1,
            "filename": "friendlywords-1.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "48a635e97e87cbb1fe607d79bac31441",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 21755,
            "upload_time": "2024-03-19T15:41:12",
            "upload_time_iso_8601": "2024-03-19T15:41:12.580291Z",
            "url": "https://files.pythonhosted.org/packages/6a/f2/8cfd5843c295073ad8fa6f60a596204d0ed8fe8f1812a5ea8e3c71cf1c03/friendlywords-1.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0bcc0236704916a4cff8a4766c2d4ee7451eecdfa1bb198df3317f90f77793ed",
                "md5": "e4786ffa170697346fdad7afb18482c2",
                "sha256": "291454946b596f6d7814e0c409832a5c4352a13b65578ecc16836230fa19b851"
            },
            "downloads": -1,
            "filename": "friendlywords-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "e4786ffa170697346fdad7afb18482c2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 23067,
            "upload_time": "2024-03-19T15:41:14",
            "upload_time_iso_8601": "2024-03-19T15:41:14.763884Z",
            "url": "https://files.pythonhosted.org/packages/0b/cc/0236704916a4cff8a4766c2d4ee7451eecdfa1bb198df3317f90f77793ed/friendlywords-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-19 15:41:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "the-lay",
    "github_project": "py-friendly-words",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "friendlywords"
}
        
Elapsed time: 0.45967s