Ursala K Twitter Bot

Jul 1, 2016 07:00 · · 275 words · 2 minutes read twitter bot art performance art

I don’t exactly remember the conversation or how the idea came up, I think we were talking about google translate in an infinite loops until the change between rounds is minimal, but a conversation happened at work, and that let me to creating Ursala K Bot.

It’s a twitter bot that listens for a keyword, currently that keyword is Seattle, and then takes the text of the tweet and sends it through a series of translations using the Microsoft Azure Text Translation service. The current configuration is to go from English to French to Spanish to German to Italian and back to English.

I whipped up the code fairly quickly last night in node.js using a bunch of modules off of npm and creating a number of streams to process the text. Because I didn’t want the bot to be too spammy, I have a number of filters that drop the tweet if the filter matches. I drop anything with a link in it, anything that has too many tags, and anything that starts with RT. Once all that filtering is done, I then have a random filter that only allows 1% of the tweets to ever make it to the translation phase. It’s pretty straight forward, and ends up being a bunch of .pipe statements.

Already, Ursala K Bot has generated some interesting text. My favorite so far is this one:

Code for Ursala K Bot can be found on github stainlessio/ursalakbot