Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Detect the polarity of text, based on afinn-111 and emoji-emotion.
npm:
$ npm install polarity
Component:
$ component install wooorm/polarity
Bower:
$ bower install polarity
var polarity = require('polarity');
polarity(['some', 'positive', 'happy', 'cats']);
/* {
* polarity: 5,
* positive: [ 'positive', 'happy' ],
* negative: []
* }
*/
polarity(['darn', 'self-deluded', 'abandoned', 'dogs']);
/* {
* polarity: -4,
* positive: [],
* negative: [ 'self-deluded', 'abandoned' ]
* }
*/
polarity(['some', 'positive', 'happy', 'cats'], {
'cats' : Infinity
});
/* {
* polarity: Infinity,
* positive: [ 'positive', 'happy', 'cats' ],
* negative: []
* }
*/
polarity.inject({
'dogs' : -Infinity /* What?! */
});
polarity(['darn', 'self-deluded', 'abandoned', 'dogs']);
/* {
* polarity: -Infinity,
* positive: [],
* negative: [ 'self-deluded', 'abandoned', 'dogs' ]
* }
*/
Get a polarity result from given values, optionally with one time injections.
polarity does not tokenise values. There are better tokenisers around (hint hint, parse-latin). However, the following will work pretty good:
function tokenize(value) {
return value.toLowerCase().match(/\S+/g);
}
Insert custom values.
Direct access to the internal values.
See Support.md.
On a MacBook Air, it detects the polarity of 142,300 tweets per second. This is with a manual tokenisation step (like the competition) taken into account. Without the tokenisation step, polarity is much faster.
benchmarks * 20 tweets (10 pos, 10 neg)
7,218 op/s » polarity -- this module
4,374 op/s » sentiment
3,182 op/s » sediment
2,284 op/s » Sentimental
MIT © Titus Wormer
FAQs
Detect the polarity (sentiment) of text
The npm package polarity receives a total of 10 weekly downloads. As such, polarity popularity was classified as not popular.
We found that polarity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.