Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Split text into sentences with a vanilla
rule based approach (i.e working ~95% of the time).
$ npm install sbd
$ yarn add sbd
var tokenizer = require('sbd');
var optional_options = {};
var text = "On Jan. 20, former Sen. Barack Obama became the 44th President of the U.S. Millions attended the Inauguration.";
var sentences = tokenizer.sentences(text, optional_options);
// [
// 'On Jan. 20, former Sen. Barack Obama became the 44th President of the U.S.',
// 'Millions attended the Inauguration.',
// ]
var options = {
"newline_boundaries" : false,
"html_boundaries" : false,
"sanitize" : false,
"allowed_tags" : false,
"preserve_whitespace" : false,
"abbreviations" : null
};
newline_boundaries
, force sentence split at newlineshtml_boundaries
, force sentence split at specific tags (br, and closing p, div, ul, ol)sanitize
: If you don't expect nor want html in your text.allowed_tags
: To sanitize html, the library santize-html is used. You can pass the allowed tags option.preserve_whitespace
: Preserve the literal whitespace between words and sentences (otherwise, internal spaces are normalized to a single space char, and inter-sentence whitespace is omitted). Preserve whitespace has no effect if either newline_boundaries or html_boundaries is specified.abbreviations
: list of abbreviations to override the original ones for use with other languages. Don't put dots in your custom abbreviations.You can run unit tests with npm test
.
If you feel something is missing, you can open an issue stating the problem sentence and desired result. If code is unclear give me a @mention. Pull requests are welcome.
npm install -g browserify
npm run-script build
FAQs
Split text into sentences with Sentence Boundary Detection (SBD).
The npm package sbd receives a total of 7,932 weekly downloads. As such, sbd popularity was classified as popular.
We found that sbd 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.