Skip to content

Instantly share code, notes, and snippets.

@mertvetsky
Last active July 1, 2016 00:58
Show Gist options
  • Save mertvetsky/0ac0d5a248dde19b98cb3714e5b4a63c to your computer and use it in GitHub Desktop.
Save mertvetsky/0ac0d5a248dde19b98cb3714e5b4a63c to your computer and use it in GitHub Desktop.
import random
def get_vow(): return random.choice(list('уеыаоэяию'))
def get_con(): return random.choice(list('йцкнгшщзхфвпрлджчсмтб'))
def get_word(length=0):
vow = con = 0
result = ''
while length > 0:
if vow > 1:
result += get_con()
con += 1
vow = 0
elif con > 1:
result += get_vow()
vow += 1
con = 0
elif random.randint(0, 1) == 1:
result += get_con()
con += 1
vow = 0
else:
result += get_vow()
vow += 1
con = 0
length -= 1
return result
word_count = random.randint(3, 7)
line = ''
while word_count > 0:
line += get_word(random.randint(2, 7))
line += ',' if random.randint(0, 5) == 0 and word_count != 1 else ''
line += random.choice(['.'] * 5 + ['!', '?', '?!', '!!']) if word_count == 1 else ' '
word_count -= 1
print(line.capitalize())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment