Giter Club home page Giter Club logo

sentiment-analyzer's Introduction

sentiment-analyzer

A machine learning application of sentiment classifying written in Python3.6.

Requirements
  1. Python3.6
  2. For pip modules run: pip install -r requirements.txt or pip install nltk scikit-learn scipy

By using the 5 classifiers:

  1. Naive Bayes Classifier
  2. Multinomial Naive Bayes Classifier
  3. Bernoulli Naive Bayes Classifier
  4. Logistic Regression Classifier
  5. Linear SVC Classifier

All classifiers were trained on 10.000 short reviews of movies that were either positive (pos) or negative (neg). By combining the votes of these 5 classifiers a custom Voted Classifier has been constructed. This Voted Classifier (VCLF) uses the votes of the 5 trained classifier to come to a classification of a given string.

If you wish to use this classifier for yourself do the following steps:

  1. git clone https://github.com/DanielPerezJensen/sentiment-analyzer.git
  2. cd sentiment-analyzer
  • If you want to train the classifiers on other data do this:
    1. Put positive reviews in "sentiment_data/positive" and negative reviews in "sentiment_data/negative". Separate every review by a newline.
  1. python3.6 train_clf.py
  2. If you get an error create these directories: pickled/data and pickled/algorithms
  3. Now you can import sentiment.py in files that are in the sentiment-analyzer directory.
  4. Usage:
    > from sentiment import sentiment
    > print(sentiment("This movie was great"))
    > pos 1
    > print(sentiment("I have had a really bad afternoon to be honest"))
    > neg 1
With thanks to Sentdex from pythonprogramming.net for coding examples and the training data.

sentiment-analyzer's People

Contributors

danielperezjensen avatar

Stargazers

PEP 8 Speaks avatar

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.