Reading a text score means asking a language a question it can answer. A nodejs readability package that ships coefficients and hyphenation data for 86 languages has to carry that data itself, and @globus.studio/readsight carries it with zero runtime dependencies.
Code: ReadSightJS, MIT licensed.
Node 18 or newer, ESM and CommonJS from one package, TypeScript types included.
There is no score-everything call
The API asks you to name the formula:
import { ReadSight } from "@globus.studio/readsight";
const rs = new ReadSight("en-us");
for (const formula of rs.getSupportedFormulas()) {
const result = rs.score(formula, text);
// result.score, result.gradeLevel, result.interpretation
}
That is a decision about honesty. A single “readability score” would have to choose a formula for you, and the choice depends on the language and on what the text is for. The loop makes the choice visible.
getSupportedFormulas() returns what fits the language: nine for en-us, eleven for es, eight for de-1996, five universal ones for th.
The result object explains itself
Every call returns score, gradeLevel, interpretation, formulaName, languageCode and inputs. The inputs map holds the intermediate counts: words, sentences, syllables, letters, polysyllables.
Intermediate values are what makes a number debuggable. When a German text scores 18 on Gunning Fog, inputs shows whether sentences or long words did it, and the answer changes which sentence gets edited.
Three syllable modes, one rule
tex is the default: the Frank M. Liang algorithm with patterns from hyph-utf8. It is exact about hyphenation points and approximate about syllable counts, because line breaking is not phonetics.
composite is used for en-us and en-gb: a heuristic counter for problem words, TeX for the rest. heuristic is used for ru, uk, be and bg, where one vowel equals one syllable, with vowelMode: "individual" so дыхание counts as four.
Eighty languages run on TeX patterns, two on composite, four on heuristic. splitWord() always uses the exact TeX hyphenator regardless of mode, which is the right split: exact where it matters, honest about where it does not.
Data ships with the module
Language JSON, coefficients and .tex pattern files are packaged with the module, and compiled patterns are cached in the OS cache directory. A container does not need a data volume, and a lambda does not need a network call before its first score.
The configuration hook exists for the opposite case: ReadSight.setDefaultConfig(new Config(patternsDir, languagesDir, cacheDir)) or ReadSight.withConfig(), and addHyphenations() for a domain word the patterns break wrongly.
What the test suite checks
Coverage is enforced at 100%, and parity with the PHP reference runs against golden vectors: supported formula lists, analyze metrics, every applicable formula with its inputs, and per-word syllable vectors across 86 languages at 1e-9.
That is the part worth copying in any port. A port that only passes its own tests proves consistency with itself; golden vectors prove consistency with the thing it claims to reproduce.
Where it fits and where it does not
A Node build step, a static site generator plugin, a CMS webhook that scores a draft before publishing. Anywhere the text is already in JavaScript.
Two calls cover most integrations: analyze() for counts, score() per formula for the numbers an editor understands. Neither needs configuration, and the language code is the only required argument.
It does not decide whether the text is good, does not parse structure and does not touch performance. Dale-Chall and Spache estimate difficult words from syllable counts, and the readme says so rather than implying a word list that is not there.
Related: semantic table for another package that keeps its footprint small, and native file input for the same preference for platform behaviour over reimplementation.