Return to site

Can An Algorithm Be Funny? This Is How We Created An Automatically Generated Comic Strip

We told a computer to create a comic strip. Follow "Nordic Diplomacy" on Instagram (@nordicdiplomacy).

· illustration

There is a trend towards the absurd in modern comics; a story lacking punchlines, satire or any sort of point. But absurdity and randomness can be funny. We wanted to push this as far as possible by giving an algorithm – a script coded in Python – power over a comic strip's narrative. Thus “Nordic Diplomacy” was born.

One square from a Nordic Diplomacy comic strip.

The graphics are drawn by me, and the coding is done by my friend Alexander Uggla. Each strip consists of three frames of two politicians discussing. At this point, the characters are the President of Finland, Mr. Sauli Niinistö, and the Prime Minister of Sweden, Mr. Stefan Löfven – both prominent Nordic leaders – but we might add new ones to the gallery later.

Each politician has a number of body poses and a number of heads. The sentences are quotes from our main characters' real speeches held in English, or translated into English, found here and here. So far we have about 60 speeches from 2018-2021 in our database.

broken image

Feeding the Algorithm

For splitting the speeches into sentences, we used the Natural Language Toolkit and the Punkt module. The sentences were then loaded into a SQLite database, which was simple yet fast enough for this project. At the moment we have about 2000 sentences in our database.

We had to limit the sentences to a maximum of about 80 characters so they would visually fit into the comic strip. As a bonus, we found that shorter sentences were generally funnier since they usually are high-flying truisms and pompous statements.

A hand-drawn picture showing code being painted ower and a hand writing the "Nordic Diplomacy" logo.

Too Much Dada On the First Try

I had been working on the graphics and Alexander coding for a while, and it was time for the algorithm to spit out its first comic strip. Randomness had been our guiding star, so almost every part of the puzzle was guided by chance.

The graphics were put together as transparent png files with random heads, bodies and sometimes foregrounds/backgrounds. For this we used the Pillow library. The random sentences from our database were formatted using the Hypenator module.

It was thrilling to see our comic come to life. The conversation was totally pointless, unstructured and non-linear – and the body language added another layer of randomness to the conversation. We thought it was hilarious.

We asked some friends for beta testing, without telling them it was computer generated. While they enjoyed the graphics and certain sentences, they felt somewhat stupid since they did not get the point. (Well, duh!) Especially when the last quote in the last square was totally out of context the whole comic strip fell flat, since one expects a punchline at the end.

We realised that we had to tweak the algorithm. We had to make the fictional conversation a bit more coherent, while still keeping the overall whimsical and dadaistic feel.

Randomness With Some Rules

We had to come up with a way to glue the sentences together and at least try to mimic an actual conversation. Each sentence had to influence the next one in some way. We started trying out the Textblob library, filtering out verbs, adjectives and nouns from the sentences. We used the lemmatization method so that we could group together the inflected forms of the words and make the key words comparable.

The result was an algorithm that chooses the first sentence at random. The second sentence then has to contain at least one key word that appears in the first sentence. The third sentence uses the same logic on the second sentence – and so on throughout the comic strip.

Through this tweaking the comic strips started to resemble real conversations. Some more so and some less, but still. However, with this prototype we decided to filter out the strips that are so absurd that they are simply not funny at all.

The first strip in the algorithm-based comic strip "Nordic Diplomacy" containing real speeches by president Sauli Niinistö and prime minister Stefan Löfven randomised by an algorithm into speech bubbles.

This is where it starts. Follow the rest on Instagram @nordicdiplomacy or on Facebook. Can an algorithm be funny? It is for you to find out!

So What Is the Point?

So how should Nordic Diplomacy be interpreted? In one way this could be seen as political satire, making fun of vague Nordic political language filled with truisms. In any case, our intention is not to make fun of anyone. If you still find some deeper meaning in our comic strips – knock yourself out. The algorithm is the star of the show. Who knows if it has a mind of its own?

Despite the chaotic randomness Nordic Diplomacy has a certain allure. Something just draws the reader in – we realised we can't wait to know what our fictional politicians will say next in this ever unfolding political drama. Follow @nordicdiplomacy and you'll never miss a strip.

And if you happen to like this kind of humor you're in for a treat: this comic strip will never run out of material. It could go on forever – and it probably will.

So can an algorithm be funny? Well, not really. But we gave the computer the chance to shine as a comedian, at least for a nanosecond of a calculation.

A square from the comic strip "Nordic Diplomacy".

Since you are here I want to show you a great platform for building a website. I built this very site in Strikingly (please feel free to have a look at it beyond this blog post). It is mobile optimised and works great on all plattforms. It is super easy to build with an elegant look and (really) useful features. Strikingly is free to test out. If you think Strikingly is for you then please click on the picture below – and you'll help me get a referral bonus at no extra cost for you.

All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OK