Sixsided
Interactive Dev in Portland, OR

1. The setup

My friend Scott recently approached me with a proposal: write a script that generates random phrases in the style of Warren Ellis’ Tweets. An interesting project! Ellis typically greets his audience with phrases like:

  • Good evening, sinners
  • Good afternoon, sex ocelots of the eschaton
  • Good morning, oozing filth stoats of the Twitternet
  • ATTENTION SCUM: You’re obviously all terrible people

There’s definitely a family resemblance among the phrases, but they’re not just fill-in-the-blank generica. You can’t generate them by simple string substitution (unlike all those lame Livejournal memes). I decided to analyze the formal grammar of Ellis’ utterances and write an inverse parser. Oh, don’t look at me like that. It’ll be fun!

--cut--

Poring over the dictionary of hundreds of sample phrases which Scott had painstakingly gathered, it was obvious that the most common Warren Ellis greeting had the form:

  • Good (time_of_day), (term_of_abuse)

That is, “good morning, scum”, “good evening, filth”, “good afternoon, meat creatures”, etc. There were a lot of variations on this theme, using words relatively more or less abusive or affectionate. Let’s drop the “good morning/good evening” prefix and focus on the name-calling, which is rich and deep. Three of its many forms:

  • my (sexy) little (mammals) of (sexiness_etc)
  • my (disturbing_and_or_beautiful) (monsters) of (the_internet)
  • you (filthy) (scum) (appendages)

The (parenthesized) words are placeholders — they’re the names of the categories and subcategories that started to emerge as I stared deep into the abyss of Ellis’ vocabulary. Let’s examine some of these categories:

Insults:

scum short, abusive terms like “scum” and “filth,” they can be used anywhere and go well well with filthy
bastards more complex phrases like “holy fools” and “space whores” that only fit in shorter sentences
attentive_filth punchy phrases that only work well after calls to action like “ATTENTION!”

Critters:

mammals things Warren Ellis would have sex with; accordingly, this gets used adjacent to sexy and sex a lot.
beasts things Warren Ellis would get a tattoo of; goes well with sublime and ill_omen
monsters creepy flesh-eating things; for some reason this also appears next to sexy often. Oh, Warren. What did they do to you?

Eventually, the following syntax tree emerged:

2. In which a domain-specific language is not the answer

The above diagram was generated from an Extended Backus-Naur Format. definition of the Warren Ellis grammar. The red words denote what I’ve been calling “placeholders”, while the blue words are literals. At the time of this writing, EBNF was as awesome and under-appreciated as regexes were in the nineties. (I expect it will remain so, until Perl 6 slaps everyone upside the head with grammars as a native language feature.) So I wrote an EBNF parser and evaluator. I had it up and running, generating Ellis phrases, when I realized I’d have to:

  • teach Scott how to use it
  • add error-checking and useful error messages
  • document it
  • maintain it

I decided to take another route. The syntax diagram above could also be viewed as a flowchart. I’d express the grammar in pure PHP code. After converting the phrase dictionary into native PHP arrays and functions, I was able to write code like this:

 
echo "Good " . time_of_day() . ", my little " . internet() . " " . scum() . " " . horde();

Much more straightforward than the previous approach. Where randomness was needed, I used rand() and switch/case statements; where sentences needed to be patched up by singularizing, pluralizing, or capitalizing a phrase, I just used PHP functions.

3. Warren Ellis is Love

I’d established a system I could reasonably hand off to Scott and company. Now I began to make the grammar finer-grained, richer and more detailed. I added a few of my own words and phrases to the mix, and learned something surprising: Warren Ellis’ tone is a delicate thing. Make the language slightly more abusive, and it stops sounding like him. And I think this is because, despite all the muck and profanity, Ellis has no scorn for his audience. His fans want to be called oozing sex ducklings, you know? It’s not an insult. It’s better than being an office manager or whatever. And I think Ellis recognizes this: Mixed in with all the dire words of abuse is the term “ordinary humans.” That is the worst he can come up with, the absolute nadir in the Ellis canon, because it’s what none of us want to be, and it’s what all of us are. And there’s something beautiful about this, about the state of mind suggested by that one phrase’s presence among all the Red-Bull-saturated glossolaliac filth. Kind of a Fight Club feeling, like the whole trope of the “abusive Warren Ellis greeting” is just him giving a nod to the rejected parts of ourselves, the darker parts, which we treasure despite their abhorrence.

Anyway, check out the generator over on talklikewarrenellis.com. Refresh the page. LEARN SOMETHING ABOUT YOURSELF.

Peace out, spooklettes.