1.0.0 • Published 9 years ago

retext-porter-stemmer v1.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
9 years ago

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.

Related

License

MIT © Titus Wormer

1.0.0

9 years ago

0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago