Giter VIP home page Giter VIP logo

urban-robot's Introduction

Urban Robot

Urban Robot

Reddit bot which replies to sarcastic comments

Libraries

  • numpy, scipy - For Mathematical and Scientific processes
  • nltk - NLP Application
  • scikit - Model Training and Feature Extraction
  • textblob - Sentiment Analysis
  • pickle - Pickling Models and Vectorizers
  • langdetect - Language Detection of comments
  • praw - Reddit Bot

Features Used

  • Sentiment Analysis of full text, equal 2 and 3 parts of text
  • n-grams - 1 to 5
  • Term Frequency–Inverse Document Frequency(TF-IFD) after stemming, tokenizing and using n-grams of 1 to 5
  • Part of Speech Dictionary Vector
  • Topic Modeling

Data Preprocessing

  • Removed URLs
  • Removed Stopwords
  • Removed words with less than 4 tokens

Model Training and Classification

Using above Features and Preprocessing 4 models are trained,

  • Logistic Regression
  • Linear SVM
  • SVM with Gaussian Kernel
  • Random Forest

If a comment is predicted as 'sarcastic' by 3 out 4 models, it is treated as sarcastic.

Files

  • classifier.py - Training and Testing Models
  • bot.py - Reddit Bot
  • cli_bot.py - A Command Line Interactive Interface for the Reddit Bot
  • main.ipynb - iPython Notebook led to the final model hypothesis

Running

  1. Register for new Reddit App here and fill details (username, password, client id, client secret) under name 'bot1' in praw.ini

  2. Run classifier.py with Python 3(Optional) or use pretrained models

  3. Run bot.py with Python 3 for the automated Reddit Bot

  4. Run cli_bot.py with Python 3 for an interactive version of the Reddit Bot.

That's it.

Logs can accessed at comment.log

How to fill praw.ini

Final accuracy of models are in final_accuracy.txt

Dataset

Dataset is available in container

Downloaded from here

urban-robot's People

Contributors

mubaris avatar shreyansh26 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

urban-robot's Issues

Chatbot Discussion

If you want urban-robot to convert to a chatbot, please share thought here.

Use Sarcasm v2 Dataset

Sarcasm v2 is a better dataset for this project. Since it has both parent comment and reply. Apply this dataset to make the prediction better.

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.