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.
a frequency analysis of the terms in a text
it uses nlp-compromise for proper tokenization & normalization
t.ngram({min_count:1, max_size:5})
options.min_count = 1 // throws away seldom-repeated grams
options.max_size = 5 // maximum gram count. prevents the result from becoming gigantic
var nlp = require('nlp_compromise');
var nlpNgram = require('nlp-ngram');
nlp.plugin(nlpNgram);
var t = nlp.text('she said she swims');
t.ngram()
/*
[ [ { word: 'she', count: 2, size: 1 },
{ word: 'said', count: 1, size: 1 },
{ word: 'swims', count: 1, size: 1 } ],
[ { word: 'she said', count: 1, size: 2 },
{ word: 'said she', count: 1, size: 2 },
{ word: 'she swims', count: 1, size: 2 } ],
[ { word: 'she said she', count: 1, size: 3 },
{ word: 'said she swims', count: 1, size: 3 } ],
[ { word: 'she said she swims', count: 1, size: 4 } ] ]
*/
it also takes advantage of the proper tokenization & cleverness of nlp_compromise, ie "Tony Hawk" is one token, not two:
var t = nlp.text(`Tony Hawk played Tony Hawk's pro skater`);
t.ngram()
/*
[ [ { word: 'tony hawk', count: 2, size: 1 },
{ word: 'played', count: 1, size: 1 },
{ word: 'pro', count: 1, size: 1 },
{ word: 'skater', count: 1, size: 1 } ],
[ { word: 'tony hawk played', count: 1, size: 2 },
{ word: 'played tony hawk', count: 1, size: 2 },
{ word: 'tony hawk pro', count: 1, size: 2 },
{ word: 'pro skater', count: 1, size: 2 } ],
[ { word: 'tony hawk played tony hawk', count: 1, size: 3 },
{ word: 'played tony hawk pro', count: 1, size: 3 },
{ word: 'tony hawk pro skater', count: 1, size: 3 } ],
[ { word: 'tony hawk played tony hawk pro', count: 1, size: 4 },
{ word: 'played tony hawk pro skater', count: 1, size: 4 } ] ]
*/
var t = nlp.text(`Tony Hawk played Tony Hawk's pro skater`);
t.ngram({min_count:2})
// [ [ { word: 'tony hawk', count: 2, size: 1 } ], [], [], [] ]
FAQs
frequency-analysis of the terms in a text
The npm package nlp-ngram receives a total of 0 weekly downloads. As such, nlp-ngram popularity was classified as not popular.
We found that nlp-ngram demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.