Lexgen, or Lexical Generator, is a little toy for generating random words, random lists of words, "Mad Lib" style sentences, or any other bits of randomness you may wish to play with.

Here is where you get your very own copy of lexgen.

Click here for a web interface to the program, or go here for some examples. Note: This online version is old. The downloadable version is much more capable.

The way it works is simple, it recursively substitutes strings with values associated with them, until it can make no more substitutions. The initial string value is always ROOT, so any data file that is to be used with lexgen must have a ROOT substitution. For example, using the following data will produce on each line a random selection from the list of a, b, c and d.

ROOT:a b c d
Substitutions beyond the ROOT level are, of course, possible.

ROOT:I_think_that_lexgen_is_+ADJ+. Did_you_know_lexgen_is_+ADJ+?
ADJ:nifty neat cool useful utter_filth
Sample output from this would look something like this:

I think that lexgen is nifty.
Did you know lexgen is utter filth?
Did you know lexgen is neat?
I think that lexgen is useful.
I think that lexgen is cool.
I think that lexgen is useful.
I think that lexgen is utter filth.
Did you know lexgen is cool?
Did you know lexgen is nifty?
I think that lexgen is nifty.
You will note also from this that spaces are used to separate fields, so underscores are used if you wish to embed a space in a substitution string. Also, note how plus signs are used to separate substitution strings. For ease of reading, we use the convention that substitution strings are in upper case, but there is nothing saying they have to be. The following would work just as well.

ROOT:I_think_that_lexgen_is_+adj+. Did_you_know_lexgen_is_+adj+?
adj:nifty neat cool useful utter_filth
It's possible to create fairly random-sounding words with this, too. (or words sounding like they originated from a certain language/culture, with some tweaking of the input) Here is a fairly simple example:

C:b c d f g h j k l m n p q r s t v w x y z
V:a e i o u
Sample output from this input script would look something like this:

Download it here, go to the web interface or see some examples.