# rake-pos

> A typescript implementation of the Rapid Automated Keyword Extraction (RAKE) algorithm with Part-of-Speech post-processing

Latest version **1.0.17** (published 2023-09-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install rake-pos
pnpm add rake-pos
yarn add rake-pos
bun add rake-pos
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.17 |
| Published | 2023-09-27 |
| First published | 2023-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 47.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | Harris Lo |
| Maintainers | hlo-world |
| Keywords | keyword, extraction, rake, pos, ts, typescript |

## Links

- npm: https://www.npmjs.com/package/rake-pos
- Repository: https://github.com/hlo-world/rake-pos
- Homepage: https://github.com/hlo-world/rake-pos#readme
- Issues: https://github.com/hlo-world/rake-pos/issues
- npm.io page: https://npm.io/package/rake-pos

## Dependencies (2)

- [brill](https://npm.io/package/brill.md) ^3.1.0
- [stopwords-iso](https://npm.io/package/stopwords-iso.md) ^1.1.0

## Alternatives

- [@sapphire/ratelimits](https://npm.io/package/@sapphire/ratelimits.md) — 4.4K weekly downloads
- [js-csvparser](https://npm.io/package/js-csvparser.md) — 2.0K weekly downloads
- [@adadapted/js-sdk](https://npm.io/package/@adadapted/js-sdk.md) — 251 weekly downloads
- [@grapecity/spread-sheets-sparklines](https://npm.io/package/@grapecity/spread-sheets-sparklines.md) — 103 weekly downloads
- [@1selfworld/adchain-sdk-react-native](https://npm.io/package/@1selfworld/adchain-sdk-react-native.md) — 80 weekly downloads

## Recent versions

- 1.0.17 (latest) — 2023-09-27
- 1.0.16 — 2023-07-05
- 1.0.15 — 2023-07-05
- 1.0.14 — 2023-05-29
- 1.0.13 — 2023-05-29
- 1.0.12 — 2023-05-29
- 1.0.11 — 2023-05-29
- 1.0.10 — 2023-05-29
- 1.0.9 — 2023-05-29
- 1.0.8 — 2023-05-28
- 1.0.7 — 2023-05-28
- 1.0.6 — 2023-05-28
- 1.0.5 — 2023-05-28
- 1.0.4 — 2023-05-28
- 1.0.3 — 2023-05-28
- … 2 more at https://npm.io/package/rake-pos/versions

## README

# rake-pos: Rapid automatic keyword extraction with Part-of-Speech post-processing

The goal of this library was to create a Typescript translation of the
[javacsript implementation](https://github.com/sleepycat/rapid-automated-keyword-extraction),
which in itself was a translation of the [python implementation](https://github.com/zelandiya/RAKE-tutorial).

Extraction defaults to processing the input text as if it is written in the English language. Stop
words are provided by default using [stopwords-iso](https://github.com/stopwords-iso/stopwords-iso)

In addition, Part-of-Speech post-processing is used to further filter keywords. This is done by
using [an implementation of brill tagging](https://github.com/words/brill). For usage details,
see the [list of brill tag descriptions](https://github.com/words/brill/blob/main/lib/descriptions.js)

# Basic Usage

```typescript

let keywords: string[] = [];
console.log(keywords);
> []

const input: string = 'I have some apples and bananas here for the table';
keywords = extractWithRakePos({ text: input });
console.log(keywords);
> ['table', 'bananas', 'apples']

const stop: Set<string> = new Set(['apples']);
keywords = extractWithRakePos({ text: input, additionalStopWordSet: stop });
console.log(keywords);
> ['table', 'bananas']
```

---

# Original README from javacsript implementation below:

Differences in regular expressions and stopword lists have big impacts on this algorithm and
sticking close to the python means that the code was easy to compare to ensure
that it was in the ballpark.

This algorithm is described in [Text Mining: Applications and
Theory](https://www.amazon.ca/Text-Mining-Applications-Michael-Berry/dp/0470749822)
and also in this [excellent blog
post](https://www.airpair.com/nlp/keyword-extraction-tutorial) by Alyona
Medelyan.

It operates using only the text you give it and produces surprisingly good
results. There are likely [better results
possible](http://bdewilde.github.io/blog/2014/09/23/intro-to-automatic-keyphrase-extraction/)
but these mostly seem to involve a combination of Python, Machine Learning and
a corpus of data.

The appeal of RAKE is of the "bang for the buck" variety.

Currently this library produces subtly different results than either the paper
or the original Python implementation. While the results (especially the top
scoring ones) line up nicely, these little deviations represent something to
understand and resolve.

## What's next

After hammering out differences in the results, plans are to focus on

* Fully embracing JS idioms (Promises/ES201X)
* Explore ways to improve the results as described
  [here](https://www.ijarcsse.com/docs/papers/Volume_6/5_May2016/V6I5-0392.pdf)
* Options to control result format (number, result|result+rank, etc)
* Include default stopword list.
* Improve handling of special characters and italics
* Deal with sentences that have been split over multiple lines (sentence now ends with -)

## Stopword lists

The stopword list used by the python version is [here](https://github.com/zelandiya/RAKE-tutorial/blob/master/SmartStoplist.txt).
It has a comment as the first line which might break the world...

Links to other stopword lists can be found [here](http://trialstravails.blogspot.ca/2014/04/fox-stop-words-list.html)

Any file with one word per line should be fine.

---
_Source: https://npm.io/package/rake-pos · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
