retextjs / retext-sentiment Goto Github PK
View Code? Open in Web Editor NEWplugin to detect sentiment
Home Page: http://retextjs.github.io/retext-sentiment
License: MIT License
plugin to detect sentiment
Home Page: http://retextjs.github.io/retext-sentiment
License: MIT License
Originally, it is:
function isNegation(node) {
var value;
value = node.toString().toLowerCase();
if (
value === 'not' ||
value === 'neither' ||
value === 'nor' ||
/n['’]t/.test(value)
) {
return true;
}
return false;
}
I found more negations...
for example, "please improve" is negative...
and tried to improve...
function isNegation(node) {
var value;
value = node.toString().toLowerCase();
if (
value === 'not' ||
value === 'neither' ||
value === 'nor' ||
value === 'never' ||
value === 'nobody' ||
value === 'none' ||
value === 'nothing' ||
value === 'nowhere' ||
value === 'few' ||
value === 'hardly' ||
value === 'little' ||
value === 'rarely' ||
value === 'scarcely' ||
value === 'seldom' ||
value === 'please' ||
/n['’]t/.test(value)
) {
return true;
}
return false;
}
But failed. The result for
"not good" = -3
"never good" = +3 (which should be -3)
Anything missed out?
The text "This product is not bad at all." will be classified as bad (based on the demo) whereas the meaning is actually good.
I am not sure how hard it would be to implement negation though, but I believe this piece of text is not uncommon so the case should be handled.
Hi, do I have to make a pull request to add to the sentiment data list?
New word is "ultimate".
Thanks
Sharry
Not really sure what this is supposed to reference.
I am working on a twitter-sentiment project and I have been struggling to attach the polarity of each tweet to my data. There must be something I am not understanding. Polarity is not being attached, instead 'data.sentiment' returns undefined. Thanks for all your help. Here is my code:
tweet.stream('statuses/filter', { track: 'dallas' }, function(stream) {
stream.on('data', function (data) {
//run sentiment and attach to data
retext().use(sentiment).use(function () {
return function (cst) {
console.log(inspect(cst));
};
}).process(data.text);
data.sentiment = data.polarity;
io.sockets.emit('tweet', data);
//console.log(data.user.location);
//console.log(data.tweet.location);
console.log(data);
});
});
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.