coleman-liau

Formula to detect the ease of reading a text according to the Coleman-Liau index (1975)

Usage no npm install needed!

<script type="module">
  import colemanLiau from 'https://cdn.skypack.dev/coleman-liau';
</script>

README

coleman-liau

Build Coverage Downloads Size

Formula to detect the ease of reading a text according to the Coleman-Liau index.

Install

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

npm:

npm install coleman-liau

Use

import {colemanLiau} from 'coleman-liau'

// For:
//
// Existing computer programs that measure readability are based largely upon
// subroutines which estimate number of syllables, usually by counting vowels.
// The shortcoming in estimating syllables is that it necessitates keypunching
// the prose into the computer.
// There is no need to estimate syllables since word length in letters is a
// better predictor of readability than word length in syllables.
// Therefore, a new readability formula was computed that has for its predictors
// letters per 100 words and sentences per 100 words.
// Both predictors can be counted by an optical scanning device, and thus the
// formula makes it economically feasible for an organization such as the U.S.
// Office of Education to calibrate the readability of all textbooks for the
// public school system.
//
// Containing 5 sentences, 119 words, and 639 letters or digits.
colemanLiau({sentence: 5, word: 119, letter: 639}) // => 14.53042…

API

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

colemanLiau(counts)

Given an object containing the number of words (word), the number of sentences (sentence), and the number of letters (letter) in a document, returns the grade level associated with the document.

Related

  • automated-readability — Uses character count instead of error-prone syllable parser
  • dale-chall-formula — Uses a dictionary, suited for higher reading levels
  • flesch — Uses syllable count
  • flesch-kincaid — Like flesch-formula, returns U.S. grade levels
  • gunning-fog — Uses syllable count, hard to implement with a computer (needs POS-tagging and Named Entity Recognition)
  • smog-formula — Like gunning-fog-index, without needing advanced NLP
  • spache-formula — Uses a dictionary, suited for lower reading levels

License

MIT © Titus Wormer