Пример #1
0
def make_word(generator, length, choice=random.choice):
  while True:
    parts = []
    letter_type = generator.word_start
    if letter_type is LetterType.BOTH:
      letter_type = choice([LetterType.CONSONANT, LetterType.VOWEL])

    for i in xrange(length):
      letter, letter_type = make_letter(generator, letter_type,
                                        not i, i == (length - 1), choice=choice)
      parts.append(letter)

    word = ''.join(parts)
    if not badwords.is_bad(word):
      return word
Пример #2
0
def is_bad(key):
  return badwords.is_bad(key) or (key[0] == BAD_INITIALS[CAPITALIZE])