Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple New Functionalities #2

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

retailos
Copy link

@retailos retailos commented Apr 1, 2016

TL;DR

Added the following functionalities :

  • Support for extending AFINN-111 with custom words
  • Added support for phrase-words ( ex : "don't like" )

Added the follow break functionality :

  • Transformed Sentiment Analysis to a class

Long Version

Now instead of using directly the library, the user makes a new Object :

var sentimentAnalysisLib = require('sentiment-analysis');
var sentimentAnalysis = new sentimentAnalysisLib();

sentimentAnalysis.analyseSentence('Dinosaurs are awesome!'); // +0.4

The user now can use custom words ( this is why the library now is a class )

var sentimentAnalysisLib = require('sentiment-analysis');
var sentimentAnalysis = new sentimentAnalysisLib({
    customWordsFile : 'myCustomAfinn.json'
});

sentimentAnalysis.analyseSentence('Dinosaurs are awesome!');
var sentimentAnalysisLib = require('sentiment-analysis');
var sentimentAnalysis = new sentimentAnalysisLib({
    customWords : {
        dinosaurs : -4
    }
});

sentimentAnalysis.analyseSentence('Dinosaurs are awesome!'); // 0

And this improvement/bug fix, now the library can handle words composed by multiple words ( I call them phrase-words ).
In the AFINN-111.json there're 15

  1. "can't stand"
  2. "cashing in"
  3. "cool stuff"
  4. "does not work"
  5. "dont like"
  6. "fed up"
  7. "green wash"
  8. "green washing"
  9. "messing up"
  10. "no fun"
  11. "not good"
  12. "not working"
  13. "right direction"
  14. "screwed up"
  15. "some kind"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants