Inspiration

A few presidential debates or so, I found myself so fed up with the sexist and contradictory comments that I came up with the idea for an app that alerts you when you (or those around you) say something misogynistic. It then was added to our list of hackathon ideas. Upon learning the Amazon Echo was available for development, the idea evolved into some integrated Echo functionality that would act as a family swear jar, donating to the charity of choice whenever rude or offensive comments were made in earshot. Unfortunately, all of the Amazon Echo devices were taken, so instead there is now an iPhone app that your mother can pull out at family dinners to keep everyone in line.

What it does

Pavlov basically takes in a family account and individual bank accounts, and then listens to the conversation around it. It keeps a running tally of the amount of money forfeit as a result of the inappropriate comments it hears, displayed for all to see. It will even show the latest comment that caused the money counter to increase. When the conversation is deemed over, or your wallet starts to feel a little light (it's only a dollar per comment, keep yourselves in line), you can exit the listening screen, and the app will automatically divide the amount owed between the individual accounts and submit those payments to a family account. Ideally this money would go to charity, though they aren't the most forthcoming with API sandbox keys under these circumstances. The screen will turn bright red when offensive comments are made. Not to worry, saying "sorry" will put it back.

How we built it

Our front end is entirely built in Swift, and takes advantage of the built in Speech library for iOS 10 for speech to text. The text gathered is then sent off to our Scala and Apache Spark backend to determine whether the text is considered rude. To do this, we created our own model using Spark's MLlib. The features we trained against are the emotions returned by REST calls to the IBM-Watson Tone Analyzer API, and the proportion of the text made up of curses/offensive language. Our training data came in the form of thousands of tweets, using #hope to represent positive speech and #hate and #f*you to represent negative speech. In hindsight, these datasets don't properly cover neutral speech, and as a result our text analyzer is **extremely strict. It even thinks the word "hey" is negative. Conveniently, our front end will not send a string to be analyzed until it has reached a certain length, so casual greetings shouldn't be too harshly critiqued.

Challenges we ran into

Neither of us had ever worked with machine learning or Swift before. As a result, these portions of the project took up a significant portion of our time. Finding data was also difficult. We ended up crawling twitter html to pull down the data we needed. Putting our backend up onto digital ocean has also proved extremely difficult due to maven dependency issues.

Accomplishments that we're proud of

We're extremely proud of our machine learning model. It's not the most accurate. It's not the best trained. But it was our first experience with the field, with naught but stackoverflow to help us, so we are very proud of the result. We're also proud of the speech recognition timing logic. It may seem somewhat minor, but the conclusion that listening for partial responses and analyzing them at certain lengths rather than waiting a specific amount of time between our API calls was a huge eureka moment.

What we learned

We learned that maven can be an evil witch, and that new technologies should never be something to be afraid of, but perhaps a mentor in the areas we struggled with might have helped. We also learned that diverse data is the best data, even if it adds significant setup and processing time.

What's next for Pavlov: Anti-Harassment Social Conditioning Tool

In the future we'd like to change the consequences system to actually donate to charity. We'd also like to write a Chrome plugin that uses our backend on text users type into their browsers to alert them when their comments may be harmful or offensive to others.

Built With

Share this project:

Updates