Behind the Gibberish

English can be a weird language. Despite being called three languages in a trenchcoat, the way basic words are created from sounds turned out to be somewhat simple. The Gibberish Engine follows these rules (more or less), which allows it to generate an endless stream of pronouncable "words".

Here's how it works.

Sounds in English come in two types: consonants and vowels. These do not map directly to letters, but we can compinsate for that with some arrays. These consonants and vowels are the building blocks of every word. We can represent them as 'C' for consonants, and 'V' for vowels.

There are roughy four basic word patterns in English: CCCV, CCV, CV, and VC.

CV and VC can be made with any consonant or vowel sound, but there are limits to which consonants can begin words made using CCCV or CCV. To use CCCV, the first sound must be a basic 's'. This can be followed by a sound from the list of 'p', 't', 'c', or 'k', and the final consonant must be 'r' or 'l'. For example, "SPRing" or "STRing".

CCV has more consonant options. These words begin with 'p', 't', 'c', 'k', 'b', 'g', 'f', 'th', 's', or 'ch'. Unlike the CCCV pattern, which consonants can appear in the second slot are dependent on the first consonant, but this is easily handled by Javascript arrays.

Once we have the base of the word figured out, it's time to look at word endings, prefixes, and suffixes. Endings are a made of one or more consonants from yet another list. They're optional, so we won't add them every time. Also, some vowels, like the 'oy' in 'toy' or 'soy', are expected to end the word, so we won't add an ending to any words that end with one of them.

As for prefixes and suffixes, we'll just add them randomly.

Sprinkle in a few rules to clean up any unwanted letter combinations (such as 'ii'), and you have yourself a new word!



A WFTID Website