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.2.0.tar.gz (17.8 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.2.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: generator_names-0.2.0.tar.gz
  • Upload date:
  • Size: 17.8 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.2.0.tar.gz
Algorithm Hash digest
SHA256 77322443f9f666005ab0ea668073f001ef6e69d455851dc188f235359ead7f88
MD5 b7921710962c104abcf338c54e9008d1
BLAKE2b-256 c61d95eb8b26286b388f6eaa0a15971aa6f546ba288de15b11023de0a9106c5b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for generator_names-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f162f3d2072a862e62c3e0dbe4fff3b277135f4d5886560a8f34c999e897bd86
MD5 df2e7994ab1c8a7dd6a32c7556a66daa
BLAKE2b-256 c87f44eb1c87caf8c242b8e9d84a9564c137d455a38fec073754f1378ce4bf3a

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