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 plugin to add part-of-speech (POS) tags

  • 3.0.0
  • Source
  • npm
  • Socket score

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

retext-pos

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to add part-of-speech (POS) tags.

Useful for other plugins as it adds information to nlcst nodes.

Install

npm:

npm install retext-pos

Use

var retext = require('retext')
var inspect = require('unist-util-inspect')
var pos = require('retext-pos')

retext()
  .use(pos)
  .use(plugin)
  .process('I went to the store, to buy 5.2 gallons of milk.', function (err) {
    if (err) {
      throw err;
    }
  })

function plugin() {
  return transformer
  function transformer(tree) {
    console.log(inspect(tree))
  }
}

Yields:

RootNode[1] (1:1-1:49, 0-48)
└─ ParagraphNode[1] (1:1-1:49, 0-48)
   └─ SentenceNode[23] (1:1-1:49, 0-48)
      ├─ WordNode[1] (1:1-1:2, 0-1) [data={"partOfSpeech":"PRP"}]
      │  └─ TextNode: "I" (1:1-1:2, 0-1)
      ├─ WhiteSpaceNode: " " (1:2-1:3, 1-2)
      ├─ WordNode[1] (1:3-1:7, 2-6) [data={"partOfSpeech":"VBD"}]
      │  └─ TextNode: "went" (1:3-1:7, 2-6)
      ├─ WhiteSpaceNode: " " (1:7-1:8, 6-7)
      ├─ WordNode[1] (1:8-1:10, 7-9) [data={"partOfSpeech":"TO"}]
      │  └─ TextNode: "to" (1:8-1:10, 7-9)
      ├─ WhiteSpaceNode: " " (1:10-1:11, 9-10)
      ├─ WordNode[1] (1:11-1:14, 10-13) [data={"partOfSpeech":"DT"}]
      │  └─ TextNode: "the" (1:11-1:14, 10-13)
      ├─ WhiteSpaceNode: " " (1:14-1:15, 13-14)
      ├─ WordNode[1] (1:15-1:20, 14-19) [data={"partOfSpeech":"NN"}]
      │  └─ TextNode: "store" (1:15-1:20, 14-19)
      ├─ PunctuationNode: "," (1:20-1:21, 19-20)
      ├─ WhiteSpaceNode: " " (1:21-1:22, 20-21)
      ├─ WordNode[1] (1:22-1:24, 21-23) [data={"partOfSpeech":"TO"}]
      │  └─ TextNode: "to" (1:22-1:24, 21-23)
      ├─ WhiteSpaceNode: " " (1:24-1:25, 23-24)
      ├─ WordNode[1] (1:25-1:28, 24-27) [data={"partOfSpeech":"VB"}]
      │  └─ TextNode: "buy" (1:25-1:28, 24-27)
      ├─ WhiteSpaceNode: " " (1:28-1:29, 27-28)
      ├─ WordNode[3] (1:29-1:32, 28-31) [data={"partOfSpeech":"CD"}]
      │  ├─ TextNode: "5" (1:29-1:30, 28-29)
      │  ├─ PunctuationNode: "." (1:30-1:31, 29-30)
      │  └─ TextNode: "2" (1:31-1:32, 30-31)
      ├─ WhiteSpaceNode: " " (1:32-1:33, 31-32)
      ├─ WordNode[1] (1:33-1:40, 32-39) [data={"partOfSpeech":"NNS"}]
      │  └─ TextNode: "gallons" (1:33-1:40, 32-39)
      ├─ WhiteSpaceNode: " " (1:40-1:41, 39-40)
      ├─ WordNode[1] (1:41-1:43, 40-42) [data={"partOfSpeech":"IN"}]
      │  └─ TextNode: "of" (1:41-1:43, 40-42)
      ├─ WhiteSpaceNode: " " (1:43-1:44, 42-43)
      ├─ WordNode[1] (1:44-1:48, 43-47) [data={"partOfSpeech":"NN"}]
      │  └─ TextNode: "milk" (1:44-1:48, 43-47)
      └─ PunctuationNode: "." (1:48-1:49, 47-48)

API

retext().use(pos)

Add part-of-speech (POS) tags to words using dariusk/pos-js at node.data.partOfSpeech.

Contribute

See contributing.md in retextjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 10 Mar 2020

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