GithubHelp home page GithubHelp logo

zhang-xiaoyu / sentimentstrength Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hitesh915/sentimentstrength

0.0 1.0 0.0 216 KB

This project will allow you to classify sentiments of the given sentences in english. The classification will be in five different classes, 1)Positive 2)Negative 3)Neutral 4)Highly Negative 5)Highly Positive

License: MIT License

Python 100.00%

sentimentstrength's Introduction

sentimentstrength

Sentiment classification using unsupervised learning

This project will allow you to classify sentiments of the given sentences in english. The classification will be in five different classes.

         1)Positive 
         2)Negative 
         3)Neutral 
         4)Highly Negative 
         5)Highly Positive

This is very simple to use.

All you need to do is download two files. 1) sentistrength.py 2)wordwithStrength.txt

         Step 1) Run your python file. [as you will execute that you will be asked to input a sentance]
         
         Step 2) Input a sentance. [Limitation: Endlish Words Only]
         
         Step 3) Enjoy the Output. [it can be positive, negative, neutral, highly positive, highly negative]

As the current project is based on unsupervised learning, it is making a use of a dictionary of positive and negative words.

You can find that dictionary in wordwithStrength.txt.

Different floating point values are assigned to those positive and negative words, and classification is done based on how many positive and negative words are there in that sentance.

For this project we have set threshold to +0.7 and -0.7, above and below that range will be considered as highly positive and highly negative respectively.

Example:

if float(sent_score) > 0: print tweets[index] if float(sent_score) > 0.7: print sent_score print 'Highly Positive Sentiment' else: print sent_score print 'Positive Sentiment'

    if float(sent_score) < 0:
        print tweets[index]
        if float(sent_score) < -0.7:
             print sent_score
             print 'Highly Negative Sentiment'
        else:
             print sent_score
             print 'Negative Sentiment'


    if float(sent_score) == 0:
        print tweets[index]
        print 'Neutral Sentiment'

Output would be as followed. [I'm just entering "i really love that movie", and it will give me score and classification of it]

Enter something: i really love that movie 
Text: i really love that movie
Score: 0.79375
Classificatio: Highly Positive Sentiment

Hope this project wil help you.

Feel free to contact me if you find any problem with the code. Suggestions are highly appreciated.

sentimentstrength's People

Contributors

hitesh915 avatar

Watchers

Xiaoyu Zhang 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.