Last weekend I attended Bot Summit where I saw an incredible array of talks (watch them all here!) Every talk is affecting in its own way, but today I want to mention Martin O’Leary‘s talk which called for Epic Botmaking. Martin talked about theatre, and Brecht, and lots of things I’d never learned about before. One of his suggestions was that bots lay out their entire process sometimes, so that there’s no mystery or wondering. While I wouldn’t recommend it for every bot or botmaker, I also thought it sounded like a neat opportunity for tech communication. So here’s how my latest bot, @botsburgers, works. Oh, and the source is online here!
What Is A Bob’s Burger?
Bob’s Burgers is a charming show on US TV. It makes me laugh as hard as Archer does, but it has an incredibly good heart and at times reminds me of watching Rugrats or something similarly good-natured. I don’t know how it does it. The show has a few running jokes, one of which is that Bob – who owns a burger restaurant – is obsessed with creating punning ‘Burger Of The Day’ names with unusual ingredients. They have a very regular shape: the name of the burger (like ‘Poutine on the Ritz Burger’) and then a subtitle explaining the secret ingredient (like ‘Comes with poutine fries’).
Step One – Pick An Ingredient
We start off by picking the most important word in the pun: the ingredient word that links the real phrase to the burger. I wrote a list of special ingredient words, some of which are cribbed from the Bob’s Burgers wiki (wiki contributors are the unspoken heroes of weird generative code projects, by the way). We can choose our ingredient pretty much at random, so let’s pretend we chose ‘yam’.
Step Two – Generate Rhymes
So we have our ingredient word, now we want to know words that sound like it so we can make up puns. The proper way to do this would be to break the word up into phonemes and compare them, but there are amazing sites like Rhyme Zone that have done this work already, so instead we ask them for a list of rhyming words and keep it as a rhyme set. For ‘yam’ we might get ‘lamb’, ‘spam’, ‘tram’ and so on.
Step Three – Search For A Target Phrase
Next we need a big list of cultural references. Bob’s Burgers uses films, songs, books, idioms, and more. In the past, I tried to replicate this process by taking the Top 1000 lists from big sites, but these tend to correlate badly with what people reference culturally (and 1000 is way too big, in any case). This time I took the few hundred top-grossing films of all time, and filtered out sequels and the most obscure stuff by hand. I also found a wonderful resource for idioms, where a very large list had been reduced to ‘editors picks’ of the most common ones. I tried to filter these out a bit too, as a lot of idioms actually have terrible and/or offensive origins.
Once we have this list, it’s a simple process of picking an idiom or film title, and then checking each word in the rhyme set to see if it’s in there. If we find a match (‘Silence Of The Lambs’ matches ‘lamb’ from our rhyme set) then we can replace the rhyming word for our ingredient word. And so we end up with ‘Silence Of The Yams’. To make things a bit nicer, we only replace the rhyme if it happens at the beginning or the end of a word. This generally makes sure the replacement flows well in the sentence.
Step Four – Cleaning Up
Our ingredient list is actually just a list of single pun words, like ‘honey’ or ‘yam’. In order to create the subtitle, we have a map that connects these words to a set of possible servings. So ‘honey’ might be ‘comes with honey mustard’ or ‘served with a honey glaze’. ‘Peas’ could be ‘snap peas’, ‘snow peas’, ‘steamed peas’, and so on. This is a really easy way to add extra life to the same pun word. These were all added in by hand by me.
We also have a random chance to add a character from the show beside the board. Once I made the image template wider to fit Twitter better I realised it looked a bit empty, so I added a few images of characters and a chance to add them in on either side. They add a bit of life to the boards and break up the patterns even more, which helps the tweets feel more varied over a longer period.
What Else Could We Do?
There are a few problems with @botsburgers as it stands, that I would like to solve but I’m not sure how big a task it is.
- Our replacement process here doesn’t understand syllables, so ‘bean’ rhymes with ‘lean’, and that word is in the phrase ‘clean sheet’. But ‘c-bean sheet’ doesn’t make much sense. In an ideal world, the bot would know that the ‘cl’ at the start of ‘clean’ can’t be split up.
- Human minds are wonderful things. The best puns in Bob’s Burgers are actually much less perfect rhymes than the ones @botsburgers seeks out. One of my favourites is ‘Total Eclipse Of The Havarti Burger’. Havarti sort of rhymes with heart, but not quite. In order to get these rhymes, we’d need a more sophisticated rhyming system that considered phonemes, as well as a system for rating which rhymes sound the nicest.
- Not a problem but – I’d really like to let people @-reply the bot with their own ingredient and have it whip up a burger. I might add this one soon!
I would love to get around to doing some of these, but I suspect I won’t have time. I hope that even if I don’t manage it, you still enjoy the bot a lot. Thanks for reading! Now – can I get you anything?