retext-pos
Retext POS (part-of-speech) tagger using dariusk/pos-js.
Installation
npm:
$ npm install retext-pos
Component.js:
$ component install wooorm/retext-pos
Bower:
$ bower install retext-pos
Duo:
var pos = require('wooorm/retext-pos');
Usage
var Retext = require('retext');
var visit = require('retext-visit');
var inspect = require('retext-inspect');
var pos = require('retext-pos');
var retext = new Retext()
.use(visit)
.use(inspect)
.use(pos);
retext.parse(
'I went to the store, to buy 5.2 gallons of milk.',
function (err, tree) {
tree.visit(tree.WORD_NODE, function (node) {
console.log(node);
});
}
);
API
None, the plugin automatically detects the part-of-speech tag for each WordNode
(using dariusk/pos-js), and stores the tag in node.data.partOfSpeech
.
Performance
On a MacBook Air, retext performs about 49% slower with retext-pos.
retext w/o retext-pos
181 op/s » A paragraph (5 sentences, 100 words)
20 op/s » A section (10 paragraphs, 50 sentences, 1,000 words)
retext w/ retext-pos
91 op/s » A paragraph (5 sentences, 100 words)
9 op/s » A section (10 paragraphs, 50 sentences, 1,000 words)
License
MIT © Titus Wormer