rps

retext-porter-stemmer

Retext implementation of the Porter Stemmer

Showing:

Popularity

Downloads/wk

16

GitHub Stars

2

Maintenance

Last Commit

6yrs ago

Contributors

0

Package

Dependencies

3

Size (min+gzip)

1.7KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

retext-porter-stemmer Build Status Coverage Status

retext implementation of the Porter stemming algorithm.

Installation

npm:

npm install retext-porter-stemmer

retext-porter-stemmer is also available for bower, component, and duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

var retext = require('retext');
var inspect = require('unist-util-inspect');
var stemmer = require('retext-porter-stemmer');

retext().use(stemmer).use(function () {
    return function (cst) {
        console.log(inspect(cst));
    };
}).process('A simple English sentence.');

Yields:

RootNode[1]
└─ ParagraphNode[1]
   └─ SentenceNode[8]
      ├─ WordNode[1] [data={"stem":"a"}]
      │  └─ TextNode: 'A'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"stem":"simpl"}]
      │  └─ TextNode: 'simple'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"stem":"english"}]
      │  └─ TextNode: 'English'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"stem":"sentenc"}]
      │  └─ TextNode: 'sentence'
      └─ PunctuationNode: '.'

API

None, retext-porter-stemmer automatically detects the stem of each WordNode (using wooorm/stemmer), and stores the stem in node.data.stem.

License

MIT © Titus Wormer

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100