undefinedExpert / retext-pos

Retext POS (part-of-speech) tagger

Home Page:http://wooorm.github.io/retext-pos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

retext-pos Build Status Coverage Status

Retext implementation of the Metaphone algorithm.

Retext part-of-speech (POS) tagger.

Installation

npm:

npm install retext-pos

retext-pos 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 pos = require('retext-pos');

retext().use(pos).use(function () {
    return function (cst) {
        console.log(inspect(cst));
    };
}).process('I went to the store, to buy 5.2 gallons of milk.');

Yields:

RootNode[1]
└─ ParagraphNode[1]
   └─ SentenceNode[23]
      ├─ WordNode[1] [data={"partOfSpeech":"NN"}]
      │  └─ TextNode: 'I'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"VBD"}]
      │  └─ TextNode: 'went'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"TO"}]
      │  └─ TextNode: 'to'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"DT"}]
      │  └─ TextNode: 'the'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"NN"}]
      │  └─ TextNode: 'store'
      ├─ PunctuationNode: ','
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"TO"}]
      │  └─ TextNode: 'to'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"VB"}]
      │  └─ TextNode: 'buy'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[3] [data={"partOfSpeech":"CD"}]
      │  ├─ TextNode: '5'
      │  ├─ PunctuationNode: '.'
      │  └─ TextNode: '2'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"NNS"}]
      │  └─ TextNode: 'gallons'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"IN"}]
      │  └─ TextNode: 'of'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1] [data={"partOfSpeech":"NN"}]
      │  └─ TextNode: 'milk'
      └─ PunctuationNode: '.'

API

None, the plugin automatically detects the part-of-speech tag for each WordNode (using dariusk/pos-js), and stores the tags in node.data.partOfSpeech.

License

MIT © Titus Wormer

About

Retext POS (part-of-speech) tagger

http://wooorm.github.io/retext-pos

License:MIT License


Languages

Language:JavaScript 100.0%