Above is my random sentence generator. If you don't see it, turn Java on in your browser. Basically, it compiles a list of rules governing a context free grammar into a tree-like structure, thus allowing a client program to traverse these rules at random; the result is a randomly generated sentence that complies with the rules of the grammar.
The grammars are almost BNF syntax with a few alterations; I've reduced the "::=" constructions to "=" for easier parsing, and a few obscure bits of BNF syntax aren't implemented. But the vast majority of what one needs for a grammar has been implemented in the program. You can view the default CFG rule file here.
Download the above-mentioned applet (52K) or a more complete console version (50K).
Copyright ©1996-2024, Darrick Wong. All Rights Reserved. Send feedback.