From 5c848d92a1102e273ba0225008eb9a95cda1a60c Mon Sep 17 00:00:00 2001 From: Espen Klem Date: Tue, 2 Jul 2019 14:27:20 +0200 Subject: [PATCH 1/2] Documentation + minor demo tweaks --- README.md | 45 +++++++++++++++++++++++++++++++++------------ demo/index.html | 2 +- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index fe07cf4..df5bbe8 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,28 @@ meaning.](https://en.wikipedia.org/wiki/Stop_words) [![Build Status][travis-image]][travis-url] +## Demo + +Live [stopword browser demo](http://fergiemcdowall.github.io/stopword/demo/). + ## Usage +### Node.js +```javascript +sw = require('stopword') +// sw.removeStopwords and sw.[language code] now available +``` + +### Script tag method +```html + + + +``` + + ### Default (English) By default, `stopword` will strip an array of "meaningless" English words @@ -47,6 +67,19 @@ const newString = sw.removeStopwords(oldString, [ 'even', 'a', 'custom', 'stopwo ## API +### removeStopwords + +Returns an Array that represents the text with the specified stopwords removed. + +* `text` An array of words +* `stopwords` An array of stopwords + +```javascript +sw = require('stopword') +var text = sw.removeStopwords(text[, stopwords]) +// text is now an array of given words minus specified stopwords +``` + ### <language code> Arrays of stopwords for the following 32 languages are supplied: @@ -97,18 +130,6 @@ norwegianStopwords = sw.no #### Your language missing? If you can't find a stopword file for your language, you can try creating one with [`stopword-trainer`](https://github.com/eklem/stopword-trainer). We're happy to help you in the process. -### removeStopwords - -Returns an Array that represents the text with the specified stopwords removed. - -* `text` An array of words -* `stopwords` An array of stopwords - -```javascript -sw = require('stopword') -var text = sw.removeStopwords(text[, stopwords]) -// text is now an array of given words minus specified stopwords -``` [license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat [license-url]: LICENSE diff --git a/demo/index.html b/demo/index.html index 1cba6fd..fc4eca8 100644 --- a/demo/index.html +++ b/demo/index.html @@ -15,7 +15,7 @@

Stopword demo

-

Add text with stopwords

+

Text with stopwords


From 52919733445e2cbb623e4cbc24600491e6e77850 Mon Sep 17 00:00:00 2001 From: Espen Klem Date: Tue, 2 Jul 2019 14:29:42 +0200 Subject: [PATCH 2/2] Added some text about browser availability --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index df5bbe8..a2d04f4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # stopword -`stopword` is a node module that allows you to strip stopwords from an +`stopword` is a module for node and the browser 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