retext-lancaster-stemmer
v1.0.0
Published
Retext implementation of the Lancaster (Paice/Husk) Stemmer
Downloads
19
Maintainers
Readme
retext-lancaster-stemmer
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
- retext-porter-stemmer — Uses the Porter stemming algorithm.