Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

retext-pos

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retext-pos

Retext POS (part-of-speech) tagger

  • 0.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
454
decreased by-55.92%
Maintainers
1
Weekly downloads
 
Created
Source

retext-pos Build Status Coverage Status

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);
        });
        /*
         * WordNode[1] [data={"partOfSpeech":"NN"}]
         * └─ TextNode: 'I'
         *
         * WordNode[1] [data={"partOfSpeech":"VBD"}]
         * └─ TextNode: 'went'
         *
         * WordNode[1] [data={"partOfSpeech":"TO"}]
         * └─ TextNode: 'to'
         *
         * WordNode[1] [data={"partOfSpeech":"DT"}]
         * └─ TextNode: 'the'
         *
         * WordNode[1] [data={"partOfSpeech":"NN"}]
         * └─ TextNode: 'store'
         *
         * WordNode[1] [data={"partOfSpeech":"TO"}]
         * └─ TextNode: 'to'
         *
         * WordNode[1] [data={"partOfSpeech":"VB"}]
         * └─ TextNode: 'buy'
         *
         * WordNode[3] [data={"partOfSpeech":"CD"}]
         * ├─ TextNode: '5'
         * ├─ PunctuationNode: '.'
         * └─ TextNode: '2'
         *
         * WordNode[1] [data={"partOfSpeech":"NNS"}]
         * └─ TextNode: 'gallons'
         *
         * WordNode[1] [data={"partOfSpeech":"IN"}]
         * └─ TextNode: 'of'
         *
         * WordNode[1] [data={"partOfSpeech":"NN"}]
         * └─ TextNode: 'milk'
         */
    }
);

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

Keywords

FAQs

Package last updated on 18 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc