Gramma Bot: Twitter Bot Final

Featured Posts, Twitter Bot Workshop

Proposal:
An anti-harassment twitter bot that questions the offender about their decision to use inflammatory language.

Description:
I was inspired by a teacher friend of mine who uses a socratic technique when his students call each other names. “Why did you call her that? What does that mean?” I wanted to use a bot to initiate conversation (with the bot saying something like, “Why did you feel like using this word?”) in order to make people reflect on the language they use and how it affects others.

Research:
One of the bots that inspired this project was Kevin Munger’s anti-harassment bot geared towards racists. The constraints placed on the bot were smart. It was only looking for the n-word, only when combined with an @ reply, and it checked the user’s timeline for prior offenses. Other important measures were taken that wouldn’t be feasible for my project–manually inspecting the profiles, and manually checking to make sure the two users in the interaction aren’t friends. Furthermore, in order for Munger to run his experiment, he had to hide that fact that he was using bots. I had decided that I was going to be transparent about my bot’s bot status.

I also read studies that had already done textual analysis of slurs used on twitter, like this one. Reading studies like this were important, because I realized that there was no magical Markov chain that was going to help me identify harassment on twitter without false negatives/positives. Even human experts can’t agree on what constitutes harassment. Here’s a quote from the study I linked to: “In manually coding, analysts had considerable difficulty achieving inter-annotator agreement (the extent to which both annotators agreed on the meaning of the same tweet).”

Finally, I wanted to see what other sorts of anti-harassment bots are out there. Even though there are quite a few, I had to restrict myself to bots whose code is written in javascript. This source code really jump-started my project. This is a simple bot created for a hackathon. It takes a whole slew of offensive terms and gives them different weights (for example, both “cunt” and the n-word are given weights of 3, while “fat” and “shit” are given weights of 1). If a user tweets something with a weight greater than 3, then the bot tweets out the user name and says “this comment has been marked as offensive and has been recorded.”

There are some glaring problems with this bot. If I tweet out, “I’m so fucking mad, someone just called me a cunt,” then I would get flagged for using a combination of the words “fucking” and “cunt”. That’s what you get with contextless word counters. They can’t tell the difference between a complaint about getting harassed and actual harassment (like, “You’re a fucking cunt.”) Further more, I didn’t want to call out users on a tweet-by-tweet basis. I wanted to track their behavior over time. A person could have a hundred reasons for using the word “bitch” in a tweet. But it’s definitely fair to call them out if they’ve tweeted the word “bitch” a hundred different times, no matter the reason.

The Ideal Bot:
I’m calling my bot “GrammaBot” because I want it to be satirical, rather than preachy. GrammaBot will track the words “bitch” and “cunt” only, because I want it to be relatively limited in scope. It will also only look at users in the United States because people in the UK seem to have a very different relationship with the word “cunt”. If a single user says either of these words more than 4 times, the bot will mention them in a tweet and say some variation of, “You’ve said the word ‘cunt’ 5 times since [date]. GrammaBot is wondering why you keep saying that word!”

Bot-in-progress:
Here is the source code for my bot:

So far I’ve only tested my bot in the console log (so I don’t get immediately blocked by Twitter). This is a video of what it looks like when I run my code. Because I’m using a personal account I’m tweeting the term “blahblahblahblah” instead of “cunt” to test that everything works:

Right now I’m only tracking “cunt” instead of “bitch” and “cunt”, which I actually think is good because it’s limiting the amount of data that’s coming in. Unfortunately I haven’t been able to figure out how to simultaneously filter by keyword and location (the twitter api doesn’t allow you to use both parameters at once). The good news is that by not limiting by location, I’m not missing the offenders who don’t have locations associated with their accounts. I’m also limiting the search to non-retweets. I only want the bot to identify OC (Original Content (or, for the more puerile among us, Original “Cuntent”)). You can follow @Gramma_Bot to see the offenders’ messages and Gramma’s reponses!

UPDATE: On the same day Gramma Bot launched (March 25, 2017), the application’s writing privileges were revoked. 

Before Gramma got shut down, a few funny things happened:

  1. The bot flagged itself as an offender so kept calling itself out for using the word cunt. This was a silly thing for me to forget to account for in the code, but it does play into the narrative of “LOOK AT WHAT GRAMMA BOT HAS BECOME”

2. An offender was amused/baited by the bot, responding with, “I work on those numbers, you cunt”

3. A crazy lady (whose account has just been suspended) who has devoted her twitter career to harassing the doctors and nurses who supposedly botched her breast augmentation surgery assumed that it was the nurses who created Gramma Bot to “bully” her.

4. Gramma Bot retweeted quite a few butt photos from “titty.me” so I manually got rid of those.

I’m now deciding whether to appeal twitter’s restriction and then neuter my bot so it follows twitter’s automation rules, create Gramma_Bot2 and inevitably get that account suspended, or simply let things be.

RIP Gramma Bot.

Forever Giphy Chat Bot

Twitter Bot Workshop

Assignment: Make a bot that responds to @-replies or direct messages. Use Digital Ocean to run this bot “forever” on a remote server.

My chat bot concept was to use the giphy api and tweet out a random gif using the content of the tweet as a tag. Here’s what I mean:

random_user: @GiphyChatBot chill
GiphyChatBot: @random_user [random gif that is tagged “chill”]

I think this qualifies as a chatbot because it simulates/automates a human interaction that might go like this:

Person 1: Hey bro, send me a Little Shop of Horrors gif
Person 2: Okay bro, here is your Little Shop of Horrors gif

The thing that I don’t love about the bot is that it only produces single-exchange interactions. It doesn’t create an extended conversation between user and bot. At any rate, here is an example tweet:

Make a Bot that Iterates, Enumerates or Exhausts

Twitter Bot Workshop

For this assignment I wanted to tweet out every last paragraph in a Dan Brown book. For those of you who don’t know, Dan Brown’s signature move is to end a paragraph with one-word italics:

Chaos”

Darkness”

Silence”

This is a huge source of amusement for me that understand the appeal of Dan Brown books but think that his prose is garbage! At any rate, I had to change the parameters to “chapter endings” generally. This is because even though most paragraphs worked beautifully with the 140 character max, even Dan Brown will through in the occasional 4 sentence paragraph at the end of a chapter.

Unfortunately, I wasn’t able to finish getting the bot up and running in node. Using the crontab scheduler hasn’t worked for me so far, but when it does I’ll update this post.

Making Bots with Tracery and CBDQ

Twitter Bot Workshop

Bot #1: German Word Bot
Inspired by Allison’s tangent on the phrase “basketball net” (the tangent being, there’s no rule in the English language as to why this is the conventional phrase. It could just as easily be “basket ballnet” or “basket ball net” or “basketballnet”). She mentioned German noun phrases, which I adore. So I made a quick bot that spat out English definitions of a few phrases.

Sources:
http://hellogiggles.com/10-fabulous-german-words-english-equivalent/
https://www.lsa.umich.edu/german/hmr/vokabeln/deutschhilftenglisch/

Bot #2: Fun with “Alas”
This time I was inspired this tumblr floating around Facebook:

http://dukeofbookingham.tumblr.com/post/156326730495/shakespeare-but-every-instance-of-alas-has-been

The concept is to take every instance of the word “Alas” in Shakespeare’s writings, but replace it with “Aw, shit”. I decided to take this a step further and replace “Alas” with “fuck”, “shit”, “ack”, and “Alice” (Because I love the idea that everybody’s just pissed off at some poor lady named “Alice”). I didn’t limit my quotations to Shakespeare because I wanted to have more variety in my Bot’s output. I also learned the syntax for getting the bot to remember the first expletive, and cap off the whole quotation with “Fucking [same expletive”].


Bot # 3: Bots Against Humanity
Though pretty simple, my favorite Bot is a critique against the game “Cards Against Humanity”. I know this is a much beloved game (and I used to enjoy playing it myself), but after reading a few compelling arguments against CAH (like this one), I realized that the game is actually awful.

The inspiration for this bot comes from some friends who use the “Rando Rule” whenever they play CAH. On every turn they add a random extra white card from the deck (“Rando’s deck”), and give “Rando” the black card if the random card gets chosen. Guess what? Rando has won several times, and usually finishes in the top half. This is Rando, if he were a Twitter Bot:

Help for this Bot came from JSON Against Humanity. Here’s my source code: https://github.com/mejiasparker/twitter-bots/blob/master/bots-vs-humanity