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. Has pre-defined stopword lists for 20 languages and also takes lists with custom stopwords as input.
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', 'åäö' ]
And last, but not least, it is possible to use your own, custom list of stopwords:
sw = require('stopword')
const oldString = 'you can even roll your own custom stopword list'.split(' ')
// Just add your own list/array of stopwords
const newString = sw.removeStopwords(oldString, [ 'even', 'a', 'custom', 'stopword', 'list', 'is', 'possible']
// newString is now [ 'you', 'can', 'roll', 'your', 'own']
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
- Portuguesepa_in
- Punjabi Gurmukhiru
- Russiansv
- Swedishzh
- 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.
If you can't find a stopword file for your language, you can try creating one with stopword-trainer
. We're happy to help you in the process.
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
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.