Blurninator 2005-02-13

Blurninator randomly generates strings from a context-free grammar specified (incrementally) via a Web interface.

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!
send us
an update
GPL (GNU General Public License) 
4.0/5 12
Woody Zenfell, III
ROOT \ Internet \ HTTP (WWW)
Blurninator randomly generates strings from a context-free grammar specified (incrementally) via a Web interface. Enjoy all the absurd juxtaposition of classic fill-in-the-blanks, with a constantly evolving pool of unique material your group provides.

Developer comments


I have tried to make this software reasonably robust, but I cannot say with any degree of confidence that it's safe against malicious attacks. Make a Blurninator accessible to the Internet at your own peril. Or better yet, (if you have the expertise), audit the code and provide patches (or at least let me know what problems you find).

One known problem is that, if people enter rules or new symbols with three consecutive colons in them, the Blurninator will become confused. I don't think any damage will be done beyond an inoperable Blurninator in that case. There are likely to be other similar holes to plug - things that will screw up the Blurninator but shouldn't otherwise pose security risks.


Sorry this section sucks. I don't make a habit of writing Web applications in Perl, so it took a bit of voodoo that I don't know I could reproduce to get this working on my Mac OS X machine. If you can contribute better guidelines, relevant links, setup scripts, etc. . . . please do so.

Put the blurninator directory somewhere. Tell your Web server that people can hit it. The files should have permissions like these:

-rw------- README.txt

-> doesn't really matter for this one, I guess.


-> I guess this one can be rx for group and other too, but it's not Web friendly, so I'm not sure what to recommend. (People hitting it won't break anything; they just won't get a valid response back.) returns exactly one blurn, with no decoration (not even a trailing newline), so it can be useful for building your own scripts and such.


-> the core of the Blurninator; should be there, and should be runnable by people trying to use the Blurninator.


-> two additional features, not quite ready for "prime time" because of usability issues. They work, but have quirks - like, typing in a box and pressing "return" doesn't submit what you typed, but instead clears any selected items, which is quite irritating. These aren't yet linked from other Blurninator pages, but people can hit them directly.

-rw-rw-rw- rules-blurninate
-rw-rw-rw- counter

-> files used by the Blurninator. They need to be both readable and modifiable by the Blurninator scripts.

-rw-r--r-- reset-date

-> file used by the Blurninator to report the "n blurns served since ((some time))". Only needs to be readable by the Blurninator scripts.


-> Running this script unceremoniously (no "are you sure?"s) clears out all rules, resets the blurn counter to 0, and updates the "n blurns served since ((some time))" date. I don't think you want to let Web visitors cause this script to run, unless you want them to be able to nuke the Blurninator whenever they want.

You may want to run once so that an actual date appears in "n blurns served since ((some date))", rather than some cheesy default string like "n blurns served since installation".


I guess some of this should be adapted and made available to Web visitors.

A Blurninator is made up of _production rules_, or just 'rules' for short. Each rule specifies a single symbol (nonterminal) on the left hand side, and a string (which may contain symbol references) on the right that may replace that string.

To create a blurn, the Blurninator starts with the symbol "start". It chooses (at random) a rule with "start" in its left hand side, then uses the right hand side of that rule. If the right hand side contains symbol references (which look like [noun], or [sounds_like_potato], etc. - a bunch of lowercase letters and underscores enclosed in square brackets), each referenced symbol undergoes the same treatment that "start" did.

For example, consider the following rules (perhaps added by the user at the "Add a production with a new symbol" page):

start -> I am a [noun]
noun -> banana

The Blurninator starts at "start", considers rules with "start" at the left, selects "I am a [noun].", sees the "[noun]" symbol reference, considers rules with "noun" at the left, selects "banana", sees there are no more symbol references, and generates the blurn "I am a banana."

If a user adds the rule (perhaps via the more convenient "Add a production" page):

noun -> bike thief

then sometimes the Blurninator will choose that replacement for "[noun]" instead. So sometimes you'll get the blurn "I am a banana." and sometimes "I am a bike thief."

Consider a Blurninator with the following rules (order doesn't matter):

noun -> banana
noun -> bike thief
adjective -> hasty
adjective -> rotten
adjective -> funky
adjective -> feisty
start -> I am a [adjective] [noun]

Now you could see a whole bunch of different blurns, with various combinations of adjectives and nouns, e.g. "I am a feisty bike thief." or "I am a rotten banana." or "I am a hasty banana."

Things don't have to be quite so simple, though - what if a user added this rule?:

adjective -> [noun]-like

Now you can start seeing blurns like "I am a banana-like bike thief." As you may imagine, with a decently sized set of rules (especially ones with lots of symbol references), the possible combinations rapidly grow, so you can refresh the Blurninate page over and over to see lots of blurns.

It's up to you what to name your symbols. The blurninator doesn't care whether the symbol's name is "noun", "franklin", or "auhtnoesu". I've seen symbols like "noun", "verb", "character", "creature", etc., but also "numnum", "sounds_like_believe", and "chinese_restaurant_first_word".

In my experience, the vast majority of generated blurns are too nonsensical or stupid to be funny, but some (perhaps one in 20, or so?) are pretty good. Also, I have a hypothesis that eventually the brain is worn down by a continual barrage of nonsense, and starts to cope by finding it all very funny. So don't be shy with the refresh button, and don't spend too long pondering any single blurn. Move on and get a good one.



The Blurninator can help capitalize words a little more correctly, as long as you stick to the lowercase symbol-name rule. Suppose your Blurninator contained the single rule

noun -> weasel

Adding a second rule

start -> [noun]

would give you "weasel"; adding instead the second rule

start -> [Noun]

would give you "Weasel"; if for the second rule you had instead specified

start -> [NOUN]

you'd get "WEASEL".

This can be useful for rules like the following (each is intended to be a standalone example):

character -> [Name] the [Adjective]
start -> [Verb] seaweed, [noun]-breath!

Labelled symbol references:

Suppose you wanted to write the rule

start -> [Noun], [noun], on the wall: who's the [superlative] of them all?

You probably want to get something like "Weasel, weasel, on the wall: who's the greasiest of them all?", but since each "noun" symbol reference is replaced separately, you're likely to get something that starts with "Weasel, toaster, on the wall...", which kind of spoils the effect.

Instead, use a "labelled symbol reference", which looks like [noun:1] or [noun:mirror] or something. The thing after the colon is called the "label"; if a rule has two or more symbol references with the same symbol and label, they'll be replaced using the same rule. But capitalization rules still work the way you'd expect. So you could write the above rule as:

start -> [Noun:1], [noun:1], on the wall: who's the [superlative] of them all?

or you could write something like

start -> [Cardinal:one] [noun:toke] over the line, sweet Jesus; [cardinal:one] [noun:toke] over the line.

"One toke" won't ever show up in a blurn, unless of course you have the rules

cardinal -> one
noun -> toke

(presumably among others).

"Mass editing" tools:

You can directly hit or These let you select a bunch of existing rules (by checking checkboxes), specify a symbol name, then either change all the selected rules' left hand sides to the named symbol, or make a copy of each selected rule with the named symbol on the left hand side. This can be particularly useful if you're refining a symbol's usage. For example, suppose you have (among others)

noun -> bird
noun -> love
noun -> shuttlecock
noun -> burrito
noun -> peace
start -> You don't just eat the world's [superlative] [noun], you [pejorative]!

You may start to become irritated that you're told that you shouldn't eat the world's biggest peace, or the world's greasiest love. So you might use, check the rules as follows:

noun -> bird
X noun -> love
noun -> shuttlecock
noun -> burrito
X noun -> peace
start -> You don't just eat the world's [superlative] [noun], you [pejorative]!

and move them to "abstract_noun", and you're on your way to better blurns.

Frequency tweaks

The Blurninator doesn't care whether two rules for the symbol "bob" are the same or not. So suppose you had taken the above example further, and had

concrete_noun -> bird
concrete_noun -> shuttlecock
concrete_noun -> burrito
concrete_noun -> oyster
concrete_noun -> sock
concrete_noun -> grape
concrete_noun -> roller coaster
concrete_noun -> Slinky(tm)
abstract_noun -> love
abstract_noun -> peace

Now, you might sometimes just need a noun, and don't want to go revise or copy your existing rules. You might decide to add the rules

noun -> [abstract_noun]
noun -> [concrete_noun]

which seems sensible enough. But soon you find that you're seeing "love" a lot more frequently than "sock" or "oyster", which is annoying because you spent a lot of time putting in concrete_nouns with lots of humor potential. This is because the Blurninator first chooses whether to replace a [noun] reference with [abstract_noun] or [concrete_noun] - so about half the time it'll choose one, and half the other. There are only two abstract_nouns, so "love" will come up half of that half the time, or 25% of the time a [noun] appears. But there are eight concrete_nouns, so they all compete for the concrete_noun half of the time - "sock" will only show up about 6.25% of the time.

You can skew things in the concrete_nouns' favor by making your ruleset more like:

noun -> [abstract_noun]
noun -> [concrete_noun]
noun -> [concrete_noun]
noun -> [concrete_noun]
noun -> [concrete_noun]

Now abstract_noun will only get chosen once out of 5 nouns, and all that effort that went into building a clever library of concrete_nouns will show more.

Last updated on April 29th, 2008


#string generator #context-free grammar #Web interface #web #HTML #string #generator

Add your review!