py-friendly-words

Python package to generate random human-readable strings, e.g. project and experiment names.
The word lists are taken from
glitchdomcom/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.
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
import friendlywords as fw
fw.preload()
fw.generate(1)
>>> 'square'
fw.generate(4)
>>> 'southern florentine rain college'
fw.generate('po')
>>> 'bittersweet curio'
fw.generate('pt')
>>> 'wood organization'
fw.generate('co')
>>> 'selection title'
fw.generate('po', separator='-')
>>> 'better-tabletop'
fw.generate('ppp', separator=', ')
>>> 'elegant, skitter, sunny'
fw.generate(3, separator='/')
>>> 'winter/alkaline/handsaw'
fw.generate(5, as_list=True)
>>> ['laced', 'polyester', 'ossified', 'cyclic', 'chronometer']
fw.generate('pppoc', as_list=True)
>>> ['able', 'splendid', 'harvest', 'hedge', 'playlist']
fw.predicates, fw.objects, fw.teams, fw.collections
>>> ['windy', ...], ['turnip', ...], ['alliance', ...], ['album', ...]
Notes
- You could make it reproducible by setting the
random.seed()
.