A module for generating random names in English and Russian.
Project description
GeneratorNames
Overview
GeneratorNames is a Python module that generates random names based on predefined lists of first and last names. It supports both Russian and English names with gender differentiation.
Features
- Generate random names in English and Russian.
- Supports both male and female name generation.
- Customizable output format.
- Option to save name generation history.
Installation
pip install generator-names
Usage
Initializing the Generator
from generator_names import GeneratorNames
generator = GeneratorNames(save_history=True, format='{firstname} {lastname}')
save_history(bool): IfTrue, stores generated names in history.format(str): Defines the output format using{firstname}and{lastname}placeholders. If set to'dict', returns a dictionary.
Generating Names
# Generate a random male name in English
en_name = generator.generate_name(language='en', gender='male')
print(en_name)
# Generate a random female name in Russian
ru_female_name = generator.generate_name(language='ru', gender='female')
print(ru_female_name)
language(str):'en'for English,'ru'for Russian.gender(str):'male'or'female'.
Custom Formatting
generator = GeneratorNames(format="{lastname}, {firstname}")
print(generator.generate_name(language='en')) # Output: Doe, John
Returning as Dictionary
generator = GeneratorNames(format='dict')
name_dict = generator.generate_name(language='ru')
print(name_dict) # Output: {'firstname': 'Иван', 'lastname': 'Петров'}
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
generator_names-0.3.0.tar.gz
(18.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file generator_names-0.3.0.tar.gz.
File metadata
- Download URL: generator_names-0.3.0.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e71be9570afbb3526b8aed03ac920ca9d7754f639f852a0f068d1502d9b876e
|
|
| MD5 |
4b64f60b59271adbb860bc1e3588caf1
|
|
| BLAKE2b-256 |
d022aec791b2a2dc4b300809809aff3afd525a8c281e6da58384a5c9d5c35024
|
File details
Details for the file generator_names-0.3.0-py3-none-any.whl.
File metadata
- Download URL: generator_names-0.3.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b61e2b78f12f0b562aadbd77337575236d34fcbdd19ebf6c6cc0995783b340e3
|
|
| MD5 |
f659a5a94688b4690c1c322885bd4a27
|
|
| BLAKE2b-256 |
3f799a2d637c467a06231487509e9c305fcf8f858eb93a30bde4d3340abcf903
|