winkjs / wink-sentiment Goto Github PK
View Code? Open in Web Editor NEWAccurate and fast sentiment scoring of phrases with #hashtags, emoticons :) & emojis ๐
Home Page: http://winkjs.org/wink-sentiment
License: MIT License
Accurate and fast sentiment scoring of phrases with #hashtags, emoticons :) & emojis ๐
Home Page: http://winkjs.org/wink-sentiment
License: MIT License
Refer to comments in #12.
refer to pr #3
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!
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:
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:
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!
The tokenizer
has moved to 3.2.0 from 3.0.0.
Do you have any plan to support multilang ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.