Git Product home page Git Product logo

modbuddy's Introduction

ModBuddy Anti-Harassment RESTful API

ModBuddy Picture

ModBuddy is a reddit moderator tool that can detect and flag harassing and vulgar comments. It was inspired by the Hack Harassment challenge at QHacks 2017

ModBuddy is composed of two parts- a RESTful API that performs analysis on text, and a chrome extension that submits comments from Reddit for analysis.

ModBuddy uses indico.io APIs to run sentiment analysis and a custom anti-harassment text model. ModBuddy also includes detection for many common vulgar words.

The chrome extension makes POST requests to /analyze, and based on the response will highlight comments to indicate a potentially harassing or vulgar comment to the moderator.

How to use the ModBuddy Chrome Extension

  • Go to chrome:://extensions, enable developer mode.
  • Click Load unpacked extension
  • Navigate to and select the ModBuddy root directory

Here's an example of how harassing comment highlighting works

Limitations and Future Work

  • Our MVP was to highlight comments, but we also wanted to have a 'moderator menu' that allows bulk navigation to, selection, and deletion of comments. However, we were unable to complete the deletion feature in time for the deadline.
  • A future item would include allowing custom rules. Right now, the chrome extension flags a comment if any of the returned data parameters (such as containsBadWords) is out of spec

How to use the ModBuddy API

The ModBuddy server is built on the flask framework. You must have a valid installation of Python 2.7 and install the following packages using pip

  • flask
  • indicoio

After installing prerequisites, you must create a file called indico-api-key.txt in the flask/static folder, containing only your API key from the indico dashboard. To get an API key, you can sign up for a free account. Then, run python application.py, and the server will be available at 127.0.0.1 on port 80.

Demo Pages

To demonstrate the functionality without an API client, a simple web form was created. To train the model, navigate to /train and enter comments (one per line) as "non harassing" or "harassing" and click Submit Training Form. Then, navigate to /analyze (root will redirect you there), and enter a comment to be analyzed. The response will show the JSON objects returned by the API.

Example of an acceptable comment

Example of a harassing comment

API Reference

/analyze

/train

Deploying on AWS Elastic Beanstalk

To deploy on AWS elastic beanstalk, create a Python 2.7 instance in your desired configuration (Low cost instances are eligible for the free tier). Create a zip file with the files found in the flask folder. (application.py should be at the root!). Then, simply upload the zip file as the application you wish to deploy.

API Limitations

Currently, only the English language is supported. With a small amount of training data, classification may not be as accurate as possible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.