suagar10 / Ripe-Tomatoes

A Discord bot which can classify comment sentiments on the fly.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ripe-Tomatoes

A Discord bot which can classify comment sentiments on the fly.

forthebadge

Sentiment Analyser

This model can classify comment sentiments into 3 classes: Positive, Neutral and Negative.

Dataset Used

Yelp dataset. Originally this dataset contains around 8 million samples of reviews collected by Yelp over the years. These samples have stars rating from 1 to 5. For my usecase, I have grouped the star ratings to 3 broad categories.

  • 1 and 2 stars - Negative
  • 3 stars - Neutral
  • 4 and 5 stars - Positive

But since I had limited resources, I used 1.2 million reviews. Another reason why I used these many reviews was also to maintain equal number of samples for all three classes. I took 512k samples for each class.

This is their distribution: Image

Model

The model used here is a combination of 1d convolutions and bidirectional LSTMs with also an added Embedding layer of 50 dimensions. The model had a test accuracy of ≈ 82%. You can use the predictor.py file to test the code in your computer.

Discord Bot

The bot has been made using Discord's discord.py api. Its super easy to learn and make bots. I was able to deploy my bot online thanks to Heroku's free dyno. The scripts I have used are:

  • bot.py : This script runs the bot and is the main program for the bot
  • requirements.txt: This script contains all the necessary libraries required to run the bot on Heroku.
  • Procfile: This file tells Heroku server what file does it needs to run first.

Join this server to test the bot!

About

A Discord bot which can classify comment sentiments on the fly.


Languages

Language:Jupyter Notebook 96.6%Language:Python 3.4%