retext-lancaster-stemmer

1.0.0 • Public • Published

retext-lancaster-stemmer Build Status Coverage Status

retext implementation of the Lancaster (Paice/Husk) stemming algorithm.

Installation

npm:

npm install retext-lancaster-stemmer

retext-lancaster-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-lancaster-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":"engl"}]
      │  └─ TextNode: 'English'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"stem":"sent"}]
      │  └─ TextNode: 'sentence'
      └─ PunctuationNode: '.'

API

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

Related

License

MIT © Titus Wormer

Dependencies (3)

Dev Dependencies (15)

Package Sidebar

Install

npm i retext-lancaster-stemmer

Weekly Downloads

6

Version

1.0.0

License

MIT

Last publish

Collaborators

  • wooorm