Giter Site home page Giter Site logo

winkjs / wink-sentiment Goto Github PK

View Code? Open in Web Editor NEW
61.0 61.0 13.0 1.66 MB

Accurate and fast sentiment scoring of phrases with #hashtags, emoticons :) & emojis ๐ŸŽ‰

Home Page: http://winkjs.org/wink-sentiment

License: MIT License

JavaScript 100.00%
emoji emoticons hashtag nlp sentiment sentiment-analysis sentiment-classification sentiment-scores wink

wink-sentiment's People

Contributors

hannujaakkola avatar prtksxna avatar sanjayaksaxena 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  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  avatar  avatar  avatar  avatar

wink-sentiment's Issues

try to determine hashtag's sentiment

hashtag is automatically identified by wink-tokenizer; remove the # and extract the balance word and lookup the score โ€” this itself should be handle simple hashtags such as #win or #fail, etc.

We can even try regex to extract multiple words to perform look up separately for each extracted word; for example #FailedProduct can be split using /[A-Z]+[a-z]*|[0-9]+/g regex โ€” this will on match yield [ 'Failed', 'Product' ] โ€”> will result in a score of -2. If there are >1 sentiment words, then average of sentiment only words should be taken as the score.

Since hashtag is more like the category of the text, the final score from hashtags must be added with the final sentiment score of the text and the total should be divided by 2 to ensure hashtag gets its due credit!

change normalized score computation method

  1. use average of words who have sentiment score associated with them;
  2. normalize this average with average sentence length (assume 15 words);
  3. (hashtag score + this normalize score)/2 will be the final normalized score.

tokenizing working incorrectly in webpack/create-react-app production build

Hi! Thanks so much for creating this library! I was trying it out by creating a very simple React application that will do sentiment analysis for a given text input as the input changes.

The app is here -- https://react-sentiment-analyzer.netlify.com/ -- and/but although it's working pretty well on localhost in development, when I create a production build using the webpack setup in Create-React-App it appears that the way wink-sentiment tokenizes the input string doesn't work the same way it does in development. Essentially it seems to be splitting words into smaller pieces than it does in development, which makes me think that I may be importing something incorrectly.

For example, here's the local development version which shows the wink-sentiment output for the word "angry" via Redux-devtools on the right:

Screen Shot 2019-04-15 at 10 07 51 PM

Note that it's parsing it all as a single word.

As a contrast, this is the Redux devtools output for the same word on https://react-sentiment-analyzer.netlify.com/ in a production build:

Screen Shot 2019-04-15 at 10 05 40 PM

Here it's parsing the word "angry" into two tokens: a and ngry, and thereby not outputting the same sentiment.

The code I'm using to run wink-sentiment is https://github.com/kellyi/react-sentiment-analyzer/blob/master/src/utils/sentimentAnalyzer.js ->

import sentiment from 'wink-sentiment';

const sentimentAnalyzer = text => sentiment(text);

export default sentimentAnalyzer;

Do you have any idea why wink-sentiment might be tokenizing things one way in development and another in production?

Thanks again for creating this library!

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.