spache-formula

Formula to detect the grade level of text according to the (revised) Spache Readability Formula (1974)

Usage no npm install needed!

<script type="module">
  import spacheFormula from 'https://cdn.skypack.dev/spache-formula';
</script>

README

spache-formula

Build Coverage Downloads Size

Formula to detect the grade level of text according to the (revised) Spache readability formula.

See spache for a list of words which count as “known”.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install spache-formula

Use

import {spacheFormula} from 'spache-formula'

spacheFormula({word: 30, sentence: 2, unfamiliarWord: 6}) // => 4.114

spacheFormula({word: 30, sentence: 2}) // => 2.474

spacheFormula() // => NaN

API

This package exports the following identifiers: spacheFormula. There is no default export.

spacheFormula(counts)

Given the number of words (word), the number of sentences (sentence), and the number of unique unfamiliar words (unfamiliarWord) in a document, returns the grade level associated with the document.

Related

License

MIT © Titus Wormer