{"id":20827008,"url":"https://github.com/retextjs/retext-pos","last_synced_at":"2026-04-05T17:39:57.356Z","repository":{"id":18665009,"uuid":"21873092","full_name":"retextjs/retext-pos","owner":"retextjs","description":"plugin to add part-of-speech (POS) tags","archived":false,"fork":false,"pushed_at":"2024-10-23T15:37:03.000Z","size":2690,"stargazers_count":21,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-07T20:45:53.018Z","etag":null,"topics":["natural-language","of","part","pos","retext","retext-plugin","speech"],"latest_commit_sha":null,"homepage":"https://retextjs.github.io/retext-pos","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/retextjs.png","metadata":{"funding":{"github":"unifiedjs","open_collective":"unified"},"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-07-15T19:35:50.000Z","updated_at":"2025-04-23T02:34:33.000Z","dependencies_parsed_at":"2024-06-18T18:31:35.984Z","dependency_job_id":"f862ce15-2901-40f4-8622-09f0481482bc","html_url":"https://github.com/retextjs/retext-pos","commit_stats":{"total_commits":163,"total_committers":1,"mean_commits":163.0,"dds":0.0,"last_synced_commit":"d5d476a91718e583515f52b52b622ac338e703cc"},"previous_names":["wooorm/retext-pos"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext-pos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext-pos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext-pos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retextjs%2Fretext-pos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/retextjs","download_url":"https://codeload.github.com/retextjs/retext-pos/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252954144,"owners_count":21830895,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["natural-language","of","part","pos","retext","retext-plugin","speech"],"created_at":"2024-11-17T23:10:49.055Z","updated_at":"2025-12-12T04:09:45.767Z","avatar_url":"https://github.com/retextjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":[],"sub_categories":[],"readme":"# retext-pos\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n**[retext][]** plugin to add POS (part of speech) tags to words.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`unified().use(retextPos)`](#unifieduseretextpos)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a [unified][] ([retext][]) plugin to add part of speech tags\nto words.\nIt uses [`dariusk/pos-js`][posjs] and adds `node.data.partOfSpeech` on\n[`Word`][nlcst-word] nodes.\nIt works by checking each sentence, so its smarter that just passing one word\nthrough.\n\n## When should I use this?\n\nYou can either use this plugin if another plugin, or your own plugin, needs\nPOS tags!\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install retext-pos\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport retextPos from 'https://esm.sh/retext-pos@5'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import retextPos from 'https://esm.sh/retext-pos@5?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n```js\n/**\n * @typedef {import('nlcst').Root} Root\n */\n\nimport {retext} from 'retext'\nimport retextPos from 'retext-pos'\nimport {inspect} from 'unist-util-inspect'\n\nawait retext()\n  .use(retextPos)\n  .use(myRetextPlugin)\n  .process('I went to the store, to buy 5.2 gallons of milk.')\n\nfunction myRetextPlugin() {\n  /**\n   * @param {Root} tree\n   */\n  return function (tree) {\n    console.log(inspect(tree))\n  }\n}\n```\n\nYields:\n\n```txt\nRootNode[1] (1:1-1:49, 0-48)\n└─0 ParagraphNode[1] (1:1-1:49, 0-48)\n    └─0 SentenceNode[23] (1:1-1:49, 0-48)\n        ├─0  WordNode[1] (1:1-1:2, 0-1)\n        │    │ data: {\"partOfSpeech\":\"PRP\"}\n        │    └─0 TextNode \"I\" (1:1-1:2, 0-1)\n        ├─1  WhiteSpaceNode \" \" (1:2-1:3, 1-2)\n        ├─2  WordNode[1] (1:3-1:7, 2-6)\n        │    │ data: {\"partOfSpeech\":\"VBD\"}\n        │    └─0 TextNode \"went\" (1:3-1:7, 2-6)\n        ├─3  WhiteSpaceNode \" \" (1:7-1:8, 6-7)\n        ├─4  WordNode[1] (1:8-1:10, 7-9)\n        │    │ data: {\"partOfSpeech\":\"TO\"}\n        │    └─0 TextNode \"to\" (1:8-1:10, 7-9)\n        ├─5  WhiteSpaceNode \" \" (1:10-1:11, 9-10)\n        ├─6  WordNode[1] (1:11-1:14, 10-13)\n        │    │ data: {\"partOfSpeech\":\"DT\"}\n        │    └─0 TextNode \"the\" (1:11-1:14, 10-13)\n        ├─7  WhiteSpaceNode \" \" (1:14-1:15, 13-14)\n        ├─8  WordNode[1] (1:15-1:20, 14-19)\n        │    │ data: {\"partOfSpeech\":\"NN\"}\n        │    └─0 TextNode \"store\" (1:15-1:20, 14-19)\n        ├─9  PunctuationNode \",\" (1:20-1:21, 19-20)\n        ├─10 WhiteSpaceNode \" \" (1:21-1:22, 20-21)\n        ├─11 WordNode[1] (1:22-1:24, 21-23)\n        │    │ data: {\"partOfSpeech\":\"TO\"}\n        │    └─0 TextNode \"to\" (1:22-1:24, 21-23)\n        ├─12 WhiteSpaceNode \" \" (1:24-1:25, 23-24)\n        ├─13 WordNode[1] (1:25-1:28, 24-27)\n        │    │ data: {\"partOfSpeech\":\"VB\"}\n        │    └─0 TextNode \"buy\" (1:25-1:28, 24-27)\n        ├─14 WhiteSpaceNode \" \" (1:28-1:29, 27-28)\n        ├─15 WordNode[3] (1:29-1:32, 28-31)\n        │    │ data: {\"partOfSpeech\":\"CD\"}\n        │    ├─0 TextNode \"5\" (1:29-1:30, 28-29)\n        │    ├─1 PunctuationNode \".\" (1:30-1:31, 29-30)\n        │    └─2 TextNode \"2\" (1:31-1:32, 30-31)\n        ├─16 WhiteSpaceNode \" \" (1:32-1:33, 31-32)\n        ├─17 WordNode[1] (1:33-1:40, 32-39)\n        │    │ data: {\"partOfSpeech\":\"NNS\"}\n        │    └─0 TextNode \"gallons\" (1:33-1:40, 32-39)\n        ├─18 WhiteSpaceNode \" \" (1:40-1:41, 39-40)\n        ├─19 WordNode[1] (1:41-1:43, 40-42)\n        │    │ data: {\"partOfSpeech\":\"IN\"}\n        │    └─0 TextNode \"of\" (1:41-1:43, 40-42)\n        ├─20 WhiteSpaceNode \" \" (1:43-1:44, 42-43)\n        ├─21 WordNode[1] (1:44-1:48, 43-47)\n        │    │ data: {\"partOfSpeech\":\"NN\"}\n        │    └─0 TextNode \"milk\" (1:44-1:48, 43-47)\n        └─22 PunctuationNode \".\" (1:48-1:49, 47-48)\n```\n\n## API\n\nThis package exports no identifiers.\nThe default export is [`retextPos`][api-retext-pos].\n\n### `unified().use(retextPos)`\n\nAdd part-of-speech (POS) tags.\n\n###### Parameters\n\nThere are no parameters.\n\n###### Returns\n\nTransform ([`Transformer`][unified-transformer]).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line, `retext-pos@^5`, compatible\nwith Node.js 16.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`retextjs/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/retextjs/retext-pos/workflows/main/badge.svg\n\n[build]: https://github.com/retextjs/retext-pos/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/retextjs/retext-pos.svg\n\n[coverage]: https://codecov.io/github/retextjs/retext-pos\n\n[downloads-badge]: https://img.shields.io/npm/dm/retext-pos.svg\n\n[downloads]: https://www.npmjs.com/package/retext-pos\n\n[size-badge]: https://img.shields.io/bundlejs/size/retext-pos\n\n[size]: https://bundlejs.com/?q=retext-pos\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/retextjs/retext/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[health]: https://github.com/retextjs/.github\n\n[contributing]: https://github.com/retextjs/.github/blob/main/contributing.md\n\n[support]: https://github.com/retextjs/.github/blob/main/support.md\n\n[coc]: https://github.com/retextjs/.github/blob/main/code-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[nlcst-word]: https://github.com/syntax-tree/nlcst#word\n\n[posjs]: https://github.com/dariusk/pos-js\n\n[retext]: https://github.com/retextjs/retext\n\n[unified]: https://github.com/unifiedjs/unified\n\n[unified-transformer]: https://github.com/unifiedjs/unified#transformer\n\n[api-retext-pos]: #unifieduseretextpos\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretextjs%2Fretext-pos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretextjs%2Fretext-pos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretextjs%2Fretext-pos/lists"}