Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
A module for node.js that takes in text and returns text that is stripped of stopwords
stopword
is a node module that allows you to strip stopwords from an
input text. In natural language processing, "Stopwords" are words
that are so frequent that they can safely be removed from a text
without altering its
meaning.
By default, stopword
will strip an array of "meaningless" English words
sw = require('stopword')
const oldString = 'a really Interesting string with some words'.split(' ')
const newString = sw.removeStopwords(oldString)
// newString is now [ 'really', 'Interesting', 'string', 'words' ]
You can also specify a language other than english:
sw = require('stopword')
const oldString = 'Trädgårdsägare är beredda att pröva vad som helst för att bli av med de hatade mördarsniglarna åäö'.split(' ')
// sw.sv contains swedish stopwords
const newString = sw.removeStopwords(oldString, sw.sv)
// newString is now [ 'Trädgårdsägare', 'beredda', 'pröva', 'helst', 'hatade', 'mördarsniglarna', 'åäö' ]
Arrays of stopwords for the following languages are supplied:
ar
- Modern Standard Arabicbn
- Bengalibr
- Brazilian Portugueseda
- Danishde
- Germanen
- Englishes
- Spanishfa
- Farsifr
- Frenchhi
- Hindiit
- Italianja
- Japanesenl
- Dutchno
- Norwegianpl
- Polishpt
- Portugueseru
- Russioansv
- Sweedishzh
- Chinese Simplifiedsw = require('stopword')
norwegianStopwords = sw.no
// norwegianStopwords now contains an Array of norwgian stopwords
ja
Japanese and zh
Chinese Simplified have no space between words. For these languages you need to split the text into words before feeding it to the stopword
module. You can check out TinySegmenter for Japanese and chinese-tokenizer for Chinese.
Returns an Array that represents the text with the specified stopwords removed.
text
An array of wordsstopwords
An array of stopwordssw = require('stopword')
var text = sw.removeStopwords(text[, stopwords])
// text is now an array of given words minus specified stopwords
version 0.0.4, removeStopwords
returns an Array, since this
removes ambiguity around separators.
version 0.1.0 getStopwords
removed in favour of constants. removeStopwords
takes text as an Array
version 0.1.2 Updated to ES6 simplified syntax
version 0.1.5 Making syntax ES5 compatible again
version 0.1.7 Brazilian Portuguese added
FAQs
A module for node.js and the browser that takes in text and returns text that is stripped of stopwords. Has pre-defined stopword lists for 62 languages and also takes lists with custom stopwords as input.
The npm package stopword receives a total of 51,372 weekly downloads. As such, stopword popularity was classified as popular.
We found that stopword demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.