русское name generator
example name: ожэцщлыъипекова
import random
vowel : list[str] = [
'а',
'о',
'у',
'ы',
'э',
'я',
'ё',
'ю',
'и',
'е',
]
consonant : list[str] = [
'б',
'в',
'г',
'д',
'ж',
'з',
'к',
'л',
'м',
'н',
'п',
'р',
'с',
'т',
'ф',
'х',
'ц',
'ч',
'ш',
'щ',
]
ambiguous : list[str] = [
'й',
'ъ',
'ь',
]
name_end : list[str] = [
'ой',
'ов',
'ев',
'ёв',
'ив',
'ова',
'ева',
'ёва',
'цкая',
'ский',
'ський',
'ски',
'ич',
'ыч',
'на',
'ина',
'ко',
'ка',
'енко',
'акова',
'екова',
'икова'
'чук',
'юк',
'чик',
'чак',
'ец',
'ець',
]
output = ""
length = 10
for i in range(length):
blacklist : list[str] = []
prev = ""
try:
prev = output[-1]
except:
pass
invalid = True
to_out = ""
while invalid:
chance = random.randint(0, random.randint(1, random.randint(1, 2)))
if chance == 0:
to_out = vowel[random.randint(0, 9)]
elif chance == 1:
to_out = consonant[random.randint(0, 19)]
else:
to_out = ambiguous[random.randint(0, 2)]
invalid = False
if to_out == "ы":
tmpbl = [
'г',
'к',
'х',
'ж',
'ч',
'ш',
'щ'
]
if prev in tmpbl:
to_out = "и"
if to_out == "ю" or to_out == "я":
tmpbl = [
'г',
'к',
'х',
'ж',
'ч',
'ш',
'щ',
"ц",
]
if to_out == "ю":
to_out = "у"
else:
to_out = "а"
if to_out == "о":
tmpbl = [
'ж',
'ч',
'ш',
'щ',
'ц',
]
if random.randint(0, 3) == 0:
to_out = "е"
else:
blacklist.append('ж')
blacklist.append('ч')
blacklist.append('ш')
blacklist.append('щ')
blacklist.append('ц')
if prev == "т":
blacklist.append("с")
if i == 0:
blacklist.append('ь')
blacklist.append('ъ')
blacklist.append('ы')
if i == length-1:
blacklist.append('ь')
blacklist.append('ъ')
blacklist.append('й')
blacklist.append('я')
if to_out == prev:
blacklist.append(to_out)
if prev == to_out:
if to_out in ambiguous:
for i in ambiguous:
blacklist.append(i)
elif to_out in vowel:
if random.randint(0, 3):
blacklist.append(to_out)
if prev in vowel:
if to_out in vowel:
if random.randint(0, 3):
blacklist.append(to_out)
if to_out in blacklist:
invalid = True
output += to_out
output += name_end[random.randint(0, 27)]
print(output)
chatgpt generated this version
example output: Выхэжыйгуй Цюлриович Рылужяфяин
import random
# Define common Cyrillic consonants and vowels found in Russian names
consonants = "бвгджзклмнпрстфхцчшщ"
vowels = "аеиоуяэюы"
special_chars = ["й", "ь", "ъ"]
# Common syllable patterns
patterns = [
"CVC", "CV", "CVCV", "CVCVC"
]
def generate_syllable():
"""
Generates a syllable based on common Russian phonetic patterns, with occasional
use of й, ь, and ъ in appropriate positions.
"""
pattern = random.choice(patterns)
syllable = ""
for i, char in enumerate(pattern):
if char == "C":
syllable += random.choice(consonants)
elif char == "V":
syllable += random.choice(vowels)
# Occasionally add 'й' or 'ь' at the end of a syllable or name part
if i == len(pattern) - 1:
if random.random() < 0.2: # ~20% chance to add 'й' at the end
syllable += "й"
elif random.random() < 0.1: # ~10% chance to add 'ь' at the end
syllable += "ь"
return syllable
def generate_first_name(gender="male"):
"""
Generates a Russian-sounding first name by combining 2-3 syllables, with occasional use of 'ъ'.
Ensures male names end in a consonant and female names end in a vowel.
"""
num_syllables = random.choice([2, 3])
first_name = ""
for i in range(num_syllables):
syllable = generate_syllable()
# Occasionally insert 'ъ' between vowels if not at the start
if i > 0 and random.random() < 0.1 and first_name[-1] in vowels and syllable[0] in vowels:
first_name += "ъ"
first_name += syllable
# Adjust ending based on gender
if gender == "male" and first_name[-1] in vowels:
first_name = first_name[:-1] + random.choice(consonants) # Ensure consonant ending
elif gender == "female" and first_name[-1] not in vowels:
first_name += random.choice(vowels) # Ensure vowel ending
return first_name.capitalize()
def generate_last_name(gender="male"):
"""
Generates a Russian-sounding last name by combining 2-3 syllables.
Adds gender-specific endings: "ов" or "ин" for males, "ова" or "ина" for females,
with occasional 'ь' at the end for softening.
"""
num_syllables = random.choice([2, 3])
last_name = ''.join(generate_syllable() for _ in range(num_syllables))
# Add gendered ending with a small chance of adding 'ь' at the end
if gender == "male":
last_name += random.choice(["ов", "ин"])
else:
last_name += random.choice(["ова", "ина"])
return last_name.capitalize()
def generate_patronymic(gender="male"):
"""
Generates a completely random patronymic, independent of the first name.
Adds "ович"/"евич" for males and "овна"/"евна" for females.
"""
num_syllables = random.choice([2, 3])
patronymic = ''.join(generate_syllable() for _ in range(num_syllables))
# Add gendered ending
if gender == "male":
patronymic += random.choice(["ович", "евич"])
else:
patronymic += random.choice(["овна", "евна"])
return patronymic.capitalize()
def generate_russian_name(gender="male"):
"""
Generates a full Russian name in Cyrillic with a first name, patronymic, and last name.
"""
first_name = generate_first_name(gender)
last_name = generate_last_name(gender)
patronymic = generate_patronymic(gender)
return f"{first_name} {patronymic} {last_name}"
# Example usage
male_name = True
if male_name:
print(generate_russian_name("male"))
else:
print(generate_russian_name("female"))