Skip to main content

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): If True, 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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generator_names-0.3.0-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

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

Hashes for generator_names-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8e71be9570afbb3526b8aed03ac920ca9d7754f639f852a0f068d1502d9b876e
MD5 4b64f60b59271adbb860bc1e3588caf1
BLAKE2b-256 d022aec791b2a2dc4b300809809aff3afd525a8c281e6da58384a5c9d5c35024

See more details on using hashes here.

File details

Details for the file generator_names-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for generator_names-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b61e2b78f12f0b562aadbd77337575236d34fcbdd19ebf6c6cc0995783b340e3
MD5 f659a5a94688b4690c1c322885bd4a27
BLAKE2b-256 3f799a2d637c467a06231487509e9c305fcf8f858eb93a30bde4d3340abcf903

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page