Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/words/automated-readability
Formula to detect ease of reading according to the Automated Readability Index (1967)
https://github.com/words/automated-readability
automated ease readability reading
Last synced: 7 days ago
JSON representation
Formula to detect ease of reading according to the Automated Readability Index (1967)
- Host: GitHub
- URL: https://github.com/words/automated-readability
- Owner: words
- License: mit
- Created: 2014-09-15T09:00:44.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2022-11-01T13:56:52.000Z (about 2 years ago)
- Last Synced: 2024-05-08T18:46:50.595Z (6 months ago)
- Topics: automated, ease, readability, reading
- Language: JavaScript
- Homepage: https://wooorm.com/readability/
- Size: 62.5 KB
- Stars: 51
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: funding.yml
- License: license
Awesome Lists containing this project
README
# automated-readability
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]Formula to detect the ease of reading a text according to the [automated
readability index][formula].## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`automatedReadability(counts)`](#automatedreadabilitycounts)
* [Types](#types)
* [Compatibility](#compatibility)
* [Related](#related)
* [Contribute](#contribute)
* [Security](#security)
* [License](#license)## What is this?
This package exposes an algorithm to detect ease of reading of English texts.
## When should I use this?
You’re probably dealing with natural language, and know you need this, if
you’re here!
This algorithm isn’t based on syllabbles compared to some other algorithms,
which means it’s quicker to calculate.## Install
This package is [ESM only][esm].
In Node.js (version 14.14+, 16.0+), install with [npm][]:```sh
npm install automated-readability
```In Deno with [`esm.sh`][esmsh]:
```js
import {automatedReadability} from 'https://esm.sh/automated-readability@2'
```In browsers with [`esm.sh`][esmsh]:
```html
import {automatedReadability} from 'https://esm.sh/automated-readability@2?bundle'
```
## Use
```js
import {automatedReadability} from 'automated-readability'// For:
//
// The rule of rhythm in prose is not so intricate. Here,
// too, we write in groups, or phrases, as I prefer to call
// them, for the prose phrase is greatly longer and is much
// more nonchalantly uttered than the group in verse; so
// that not only is there a greater interval of continuous
// sound between the pauses, but, for that very reason,
// word is linked more readily to word by a more summary
// enunciation. Still, the phrase is the strict analogue
// of the group, and successive phrases, like successive
// groups, must differ openly in length and rhythm. The
// rule of scansion in verse is to suggest no measure but
// the one in hand; in prose, to suggest no measure at all.
// Prose must be rhythmical, and it may be as much so as
// you will; but it must not be metrical. It may be
// anything, but it must not be verse.
//
// Containing 6 sentences, 151 words, and 623 characters.
automatedReadability({
sentence: 6,
word: 151,
character: 623
})
// => 10.585982…
```## API
This package exports the identifier `automatedReadability`.
There is no default export.### `automatedReadability(counts)`
Given an object containing the number of words (`word`), the number of
sentences (`sentence`), and the number of characters (`character`) in a
document, returns the grade level associated with the document.##### `counts`
Counts from input document.
###### `counts.sentence`
Number of sentences (`number`, required).
###### `counts.word`
Number of words (`number`, required).
###### `counts.character`
Number of characters (`number`, required).
##### Returns
Grade level associated with the document (`number`).
## Types
This package is fully typed with [TypeScript][].
It exports the additional type `Counts`.## Compatibility
This package is at least compatible with all maintained versions of Node.js.
As of now, that is Node.js 14.14+ and 16.0+.
It also works in Deno and modern browsers.## Related
* [`coleman-liau`](https://github.com/words/coleman-liau)
— uses letter count instead of an error-prone syllable parser
* [`dale-chall-formula`](https://github.com/words/dale-chall-formula)
— uses a dictionary, suited for higher reading levels
* [`flesch`](https://github.com/words/flesch)
— uses syllable count
* [`flesch-kincaid`](https://github.com/words/flesch-kincaid)
— like `flesch-formula`, returns U.S. grade levels
* [`gunning-fog`](https://github.com/words/gunning-fog)
— uses syllable count, hard to implement (needs POS-tagging and NER)
* [`smog-formula`](https://github.com/words/smog-formula)
— like `gunning-fog-index`, without the need for advanced NLP tasks
* [`spache-formula`](https://github.com/words/spache-formula)
— uses a dictionary, suited for lower reading levels## Contribute
Yes please!
See [How to Contribute to Open Source][contribute].## Security
This package is safe.
## License
[MIT][license] © [Titus Wormer][author]
[build-badge]: https://github.com/words/automated-readability/workflows/main/badge.svg
[build]: https://github.com/words/automated-readability/actions
[coverage-badge]: https://img.shields.io/codecov/c/github/words/automated-readability.svg
[coverage]: https://codecov.io/github/words/automated-readability
[downloads-badge]: https://img.shields.io/npm/dm/automated-readability.svg
[downloads]: https://www.npmjs.com/package/automated-readability
[size-badge]: https://img.shields.io/bundlephobia/minzip/automated-readability.svg
[size]: https://bundlephobia.com/result?p=automated-readability
[npm]: https://docs.npmjs.com/cli/install
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[typescript]: https://www.typescriptlang.org
[contribute]: https://opensource.guide/how-to-contribute/
[license]: license
[author]: https://wooorm.com
[formula]: https://en.wikipedia.org/wiki/Automated_readability_index