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.1.0.tar.gz (3.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.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file generator_names-0.1.0.tar.gz.

File metadata

  • Download URL: generator_names-0.1.0.tar.gz
  • Upload date:
  • Size: 3.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.1.0.tar.gz
Algorithm Hash digest
SHA256 72bec2315743dd323083e25c2f9c83b658825cdddabb6e11e3cc4a6c5e35cf65
MD5 3517f405c8be26dbff74f37241049b5b
BLAKE2b-256 070dc3dc2565560048a6f6dc133dc104e6929f05f1ee3aeac23d125c2533afda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for generator_names-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d851cf2d79f294f276675ae0fa8211af5e81b1e98c51e0e26d7295c1a74b353
MD5 eef170bb53f79714bfd64f253d852d0b
BLAKE2b-256 28e33f0c55312139add0d14fd855657dd3cf3fbb5c07f36f02367f0353ac131f

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