Your task is to generate a nonsense word that is reasonably pronounceable with the specified number of 'syllables'. Each time the program is run possibly results in a different nonsense word.
A pronounceable word is made up of syllables, which are in turn made up of a vowel group that is possibly sandwiched between two consonant groups. Not all sounds are pronounceable in all positions, and since this depends on the language, we'll use patterns understandable to English speakers
Starting consonant groups:
b c d f g h j k l m n p r s t v w y z bl br ch cl cr dr fl fr gh gl gn gr kn ph pl pr qu sc sh sk sl sm sn sp st th tr wh wr sch scr shm shr squ str thr
a e i o u ae ai ao au ea ee ei eu ia ie io oa oe oi oo ou ue ui
Ending Consonant groups:
b c d f g l m n p r s t x z bt ch ck ct ft gh gn lb ld lf lk ll lm ln lp lt mb mn mp nk ng nt ph pt rb rc rd rf rg rk rl rm rn rp rt rv rz sh sk sp ss st zz lch lsh lth rch rsh rst rth sch tch
Both starting and ending consonant groups are optional in general, however you cannot place a syllable ending with a vowel immediately before one starting with a vowel.
In the interest of simplicity, certain English words can't actually be generated this way, such as vacuum, xylophone, mnemonic, pterodactyl, beautiful, blah, they, wow, and most plurals.
Possible syllable patterns using this key:
(SC) = starting consonant; (V) = vowel group; (EC) = ending consonant
For one syllable:
With two syllables:
... and so on
Input: an integer for the number of syllables to generate
Output: a (probably) nonsense word that many syllables long
- Some form of (psuedo)randomness is required. All combinations of syllables should be (theoretically) possible to generate, though the distribution does not have to be uniform.
- You may assume that your generator is aperiodic, so it doesn't have to be mathematically possible to generate every possible word (It might not have a long enough period in reality) and you don't need to provide any sort of proof that your generator can, in fact, produce every possible word.
- Your generator must actually be able to produce at least 255 distinct values, so you can't just return 4 every time the generator is called.
- What's ultimately important is that you somehow include all the above letter groups in your code, that each letter group has a nonzero probability of being picked, and each syllable pattern has a nonzero probability of occurring (if provided with true randomness).
- You must support up to 16 syllable words
- In addition to the rules on combining syllables, the output word must not have:
- 3 consecutive vowels (
u; this can happen for
- 3 consecutive matching consonants
- 3 consecutive vowels (
Note that this is distinct from Generate a pronounceable word for a few reasons:
- Variable number of syllables specified by input rather than a strict 10-letter requirement.
- This challenge adds non-exhaustive letter groups that must be (cleverly) encoded and allows for more variants of syllables, so code can't just be copied from the other challenge
- Squirdshlicker. Need I say more?
I also forgot to dupe check, but it turns out this brings enough new to the table that it doesn't matter. After all, there are hundreds of quine variant challenges.