Creating fake words: a pseudoword generator
I was trying to figure out how to create a word that's not a word. What I ended up doing was creating a way of generating a random syllable, and then simply appending 2 or 3 of them together. It seems to work well enough. Here's what I got in Python:
import random vowels = ["a", "e", "i", "o", "u"] consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z'] def _vowel(): return random.choice(vowels) def _consonant(): return random.choice(consonants) def _cv(): return _consonant() + _vowel() def _cvc(): return _cv() + _consonant() def _syllable(): return random.choice([_vowel, _cv, _cvc])() def create_fake_word(): """ This function generates a fake word by creating between two and three random syllables and then joining them together. """ syllables = [] for x in range(random.randint(2,3)): syllables.append(_syllable()) return "".join(syllables) if __name__ == "__main__": print create_fake_word()
The first four functions are for generating an individual type of syllable (V, CV, or CVC) and then _syllable() just chooses one of them at random. Finally, create_fake_word() calls _syllable() a few times and joins them together. Here is some example output:
hojocina eliphaa deaketyed ciboa tiuzi
I haven't a clue whether or not there is a better means of generating words that look somewhat real. If you know of a better method, I'd love to hear it!
