Kwet 0.31 has been released. This is an early release and may not be suitable for general use.
An online demo is now available.
kwet is a random word generator that produces words based on specifications in a grammar, or "profile". A simple profile might look like this:
consonant : p | t | k | m | n | r | s | y vowel : a | e | i | u syllable : consonant vowel word : syllable syllable | syllable syllable syllable
The first two lines define the letters that make up the words; the next two lines provide rules for how to build whole words using these letters.
Given this profile, kwet might produce words like these:
kwet can only generate random words based on the information specified in a profile. For example, it would never produce the word ayu using this profile, because it doesn't allow for words beginning with a vowel. It couldn't produce the word xolo because the letters x, o, and l aren't defined in the profile. Finally, it couldn't produce the words mu and tanekesu because the profile defines words as consisting of exactly two or three syllables.
kwet profiles may be much more complex than this simple example. Most importantly, you can specify the weight of each choice within a definition, which is what determines how likely it is to be chosen. For example, the following profile would produce the word true about half of the time and false the other half of the time:
word : true | false
But this next profile would favor the truth by a three-to-one margin:
word : 3(true) | 1(false)
Any unquoted symbol that is not defined in the profile will be interpreted as if it were quoted. For example, this profile will produce the words a and b:
word : a | b
While this profile would produce the words alpha and bravo:
word : a | b a : alpha b : bravo
To specify the empty string, use the notation w()
.
This comes in handy when want to specify an optional element:
optk : k | 1()