blackout poetry generator
Turns any web page into a work of procedurally generated blackout poetry!
To use it, just drag the blackout poetry generator bookmarklet to your browser’s bookmarks bar, then hit the button.
Or, if you’re on a mobile browser, create a new bookmark, then edit it and replace its address with the (copyable) code below:
why make this?
A lot of procedural content generation techniques involve taking a small “seed” (e.g. a grammar) and expanding it outwards. Lately, though, I’ve become more interested in subtractive procedural generation: procgen techniques that begin with a large block of “material” and create new stuff by procedurally carving most of the material away. Blackout poetry, as an inherently subtractive medium, seemed like a natural subject for my first experiment in this direction.
what inspired this?
I was mostly inspired by The Days Left Forebodings and Water, a 2016 NaNoGenMo entry by Liza Daly that makes use of very similar techniques to generate blackout poetry given a source text.
can I share the poems I make?
Yes, absolutely! If you’d like, consider sharing them in the #blackoutgen hashtag on Twitter or tweeting them at me (@maxkreminski). I’m always excited to see the stuff people make with the stuff I’ve made.
how does it work?
First, the script locates every paragraph of text (HTML
<p> tag) on the current page. Then, for each paragraph, it performs the following steps:
- Split the text up into a series of words.
- Use pos-js to annotate each word with the part of speech (noun, verb, etc) it represents.
- Adjust the part-of-speech annotations, and add on some other annotations, based on a set of additional hand-written rules.
- Run a number of matchers, each one looking for a series of words that fits a certain valid English sentence structure, over the annotated text.
- Discard all the matchers that didn’t find a matching sequence of words, and randomly select one of the remaining matchers (the ones that did).
- Rewrite the paragraph, blacking out all the words except those that were matched by the chosen matcher.
In a certain sense, then, you can think of this process as turning each individual paragraph on the page into its own tiny poem.
why a bookmarklet?
I wanted to make the poetry generator available in as many different browsers as possible, and a bookmarklet seemed like the simplest way to do that. In the future I might try porting it to a browser extension or something else that’s more robust.
where’s the source?
It’s on GitHub! You can check it out here.
who are you?
I’m Max Kreminski. I’m into game design, procgen, and computational creativity, and I make a lot of weird generative art things like this one. If you want to keep up with what I’m working on, you should follow me on Twitter!