This challenge is to list out all possible words which are built from a pattern of syllables. Words are composed by joining syllables together. Syllables are composed of a number of vowels with some number of consonants optionally to the left and/or right. Your code should take in:
- a list of consonants
- a list of vowels (the vowels and consonants may be assumed to be mutually exclusive)
- a syllable structure in some format you define; the format must contain information describing:
- the minimum and maximum number of left consonants ( >= 0)
- the minimum and maximum number of vowels ( >= 1)
- the minimum and maximum number of right consonants. ( >= 0)
- A minimum and maximum number of syllables ( >= 1)
Consonants: tk Vowels: au Structure: (c)cv(c) (means: 1 to 2 left consonants, 1 vowel, 0 to 1 right consonants) Syllables: 1 Output: ta tat tak tu tut tuk ka kat kak ku kut kuk tta ttat ttak ttu ttut ttuk tka tkat tkak tku tkut tkuk kta ktat ktak ktu ktut ktuk kka kkat kkak kku kkut kkuk Consonants: 'b', 'c', 'd' Vowels: 'e' Structure: 1, 1, 1, 2, 0, 0 (means: 1 left consonant, 1 to 2 vowels, 0 right consonants) Syllables: 1, 2 Output: be bee ce cee de dee bebe bebee bece becee bede bedee beebe beebee beece beecee beede beedee cebe cebee cece cecee cede cedee ceebe ceebee ceece ceecee ceede ceedee debe debee dece decee dede dedee deebe deebee deece deecee deede deedee Example of using a single string as input("4|P|T|C|K|2|A|I||vvV||ss") Consonants: "4|P|T|C|K|" Vowels: "2|A|I|" Structure: "|vvV||" (means: 0 left consonants, 2 to 3 vowels, 0 right consonants) Syllables: "ss" (means: 2) Output: AAAA;AAAI;AAIA;AAII;AAAAA;AAAAI;AAAIA;AAAII;AAIAA;AAIAI;AAIIA;AAIII;AIAA;AIAI;AIIA;AIII;AIAAA;AIAAI;AIAIA;AIAII;AIIAA;AIIAI;AIIIA;AIIII;IAAA;IAAI;IAIA;IAII;IAAAA;IAAAI;IAAIA;IAAII;IAIAA;IAIAI;IAIIA;IAIII;IIAA;IIAI;IIIA;IIII;IIAAA;IIAAI;IIAIA;IIAII;IIIAA;IIIAI;IIIIA;IIIII;AAAAAA;AAAAAI;AAAAIA;AAAAII;AAAIAA;AAAIAI;AAAIIA;AAAIII;AAIAAA;AAIAAI;AAIAIA;AAIAII;AAIIAA;AAIIAI;AAIIIA;AAIIII;AIAAAA;AIAAAI;AIAAIA;AIAAII;AIAIAA;AIAIAI;AIAIIA;AIAIII;AIIAAA;AIIAAI;AIIAIA;AIIAII;AIIIAA;AIIIAI;AIIIIA;AIIIII;IAAAAA;IAAAAI;IAAAIA;IAAAII;IAAIAA;IAAIAI;IAAIIA;IAAIII;IAIAAA;IAIAAI;IAIAIA;IAIAII;IAIIAA;IAIIAI;IAIIIA;IAIIII;IIAAAA;IIAAAI;IIAAIA;IIAAII;IIAIAA;IIAIAI;IIAIIA;IIAIII;IIIAAA;IIIAAI;IIIAIA;IIIAII;IIIIAA;IIIIAI;IIIIIA;IIIIII duplication test case: Consonants: k Vowels: a Structure: cVc (means: 0 to 1 left consonants, 1 vowel, 0 to 1 right consonants) Syllables: 2 Output: kakkak kakka kakak kaka kaak kaa akkak akka akak aka aak aa (note that there is only one of each aka, kaka, akak, and kakak; you get two if you treat ak a and a ka separately)
Duplicate words should be removed. The order and format of the words does not matter, as long as they can be told apart (ie, don't output one long unbroken string of letters). The max and min of the left and right consonants is any non-negative integer; the max and min of the vowel and the number of syllables is any positive integer. The set of consonants will never have tokens from the set of vowels and vice versa. There will always be at least one consonant and one vowel provided in the input. You may define the format and order of the inputs. The words of the output must be built from the same characters as those entered in the input.
code-golf, so shortest code wins. To be considered valid, solutions must at least accept English vowels and consonants as valid vowels and consonants (having only upper or lower case is still valid), and must come up with a complete and correct word list for any valid input.