JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q44856F
  • License MIT

Takes in a document, spits out a tokenised and stemmed array of terms.

Package Exports

  • stm

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (stm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

stm

Takes in a document, spits out a tokenised and stemmed array of terms. Using Porter's Algorithm.

Usage

stm.stem(text, noStopWords). Returns an array of terms, stemmed and without punctuation.

  • text is the string (text document) in which the calculations are to be performed on.
  • noStopWords defaults to true. Set to false if you want to include stop words–e.g words such as "I" and "the".

Note: This is basically a wrapper around the stem-porter library by kastor.

var stm = require('stm');

var str = "you're simply a simplistic house, made for housing";
var stemmed = stm.stem(str); // noStopWords -> `true`
>> ["simpli", "simplist", "hous", "hous"]

var withStopWords = stm.stem(str, false); // turn off the removal of stop words
>> [ 'you', 're', 'simpli', 'a', 'simplist', 'hous', 'made', 'for', 'hous'];