Giter Site home page Giter Site logo

twitter-sentiment-classifier's Introduction

A twitter sentiment classifier based on Support Vector Machines and K nearest neighbors algorithms

Overall decription

As undestood from the title, this repository contains sources codes (src folder) , datasets (data folder) and useful resources for twitter sentiment analysis (resources folder).
The training dataset is split into 3 files containing a processed version of tweets in the three classes : positive (data/used/positive1.csv), negative (data/used/negative1.csv) and neutral (data/used/neutral1.csv)

The training dataset is collected SemEval challenge ( http://alt.qcri.org/semeval2014/task9/index.php?id=data-and-tools ), STS gold(http://cs.stanford.edu/people/alecmgo/trainingandtestdata.zip) and Sanders dataset (http://www.sananalytics.com/lab/twitter-sentiment) . The testing dataset is from STS-Gold (http://cs.stanford.edu/people/alecmgo/trainingandtestdata.zip)

The test datasets are STS_Test (data/test_dataset.csv) and 100 3cixty reviews in (data/3cixty/3cixty_test_dataset.csv)

In the src folder :

  1. svm.py : svm classifier
  2. knn.py : knn classifier
  3. hybrid.py : 2 step classification : knn for objectivity/subjectivity test, svm for polarity test
    Emoticons dictionnary, Stop Words list, SentiWordnet 3.0.1, AFINN , and a slang dictionnary are in the resources folder.

Requirements -------

The classifier works for python 2.6 and 2.7
To use these algorithms you should install : sklearn 0.14 version (http://scikit-learn.org/dev/index.html) , numpy (http://www.numpy.org/), nltk 3 with full packages using nltk.download() instruction in python

Running the classifiers

Runnig any classifier of the mentioned above is done as by executing the classifier.py script as follow :
Usage : python predictor.py classifier_choice
Available classifiers are : svm, knn or hybrid

N.B : The class labels are real values and are as follow : positive : 4.0, negative : 0.0 and neutral 2.0

Thank you .

twitter-sentiment-classifier's People

Watchers

James Cloos 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.