{"id":2130642,"url":"https://github.com/words/flesch","last_synced_at":"2025-12-12T04:32:26.366Z","repository":{"id":20765055,"uuid":"24049734","full_name":"words/flesch","owner":"words","description":"Formula to detect the ease of reading a text according to Flesch Reading Ease (1975)","archived":false,"fork":false,"pushed_at":"2022-11-01T13:56:10.000Z","size":61,"stargazers_count":32,"open_issues_count":0,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-10T14:48:45.338Z","etag":null,"topics":["ease","readability","reading"],"latest_commit_sha":null,"homepage":"https://wooorm.com/readability/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/words.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":"funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"wooorm"}},"created_at":"2014-09-15T09:01:57.000Z","updated_at":"2024-08-13T19:46:31.000Z","dependencies_parsed_at":"2022-08-31T02:01:37.441Z","dependency_job_id":null,"html_url":"https://github.com/words/flesch","commit_stats":null,"previous_names":["wooorm/flesch"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/words%2Fflesch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/words%2Fflesch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/words%2Fflesch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/words%2Fflesch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/words","download_url":"https://codeload.github.com/words/flesch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225876743,"owners_count":17538318,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ease","readability","reading"],"created_at":"2024-01-21T23:24:44.522Z","updated_at":"2025-10-22T09:23:51.658Z","avatar_url":"https://github.com/words.png","language":"JavaScript","readme":"# flesch\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\nFormula to detect the grade level of text according to the [Flesch reading\nease][formula].\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`flesch(counts)`](#fleschcounts)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [Security](#security)\n*   [License](#license)\n\n## What is this?\n\nThis package exposes an algorithm to detect ease of reading of English texts.\n\n## When should I use this?\n\nYou’re probably dealing with natural language, and know you need this, if\nyou’re here!\n\nThis algorithm is based on syllables, whereas some others are not, which means\nit’s tougher to get right and slower to calculate.\n\nSee [syllable][] for detecting syllables.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 14.14+, 16.0+), install with [npm][]:\n\n```sh\nnpm install flesch\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {flesch} from 'https://esm.sh/flesch@2'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {flesch} from 'https://esm.sh/flesch@2?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n```js\nimport {flesch} from 'flesch'\n\n// For “The cat sat on the mat” (1 sentence, 6 words, 6 syllables).\nflesch({sentence: 1, word: 6, syllable: 6}) // =\u003e 116.14500…\n\n// For “The Australian platypus is seemingly a hybrid of mammal and reptilian\n// creature.” (1 sentence, 12 words, 23 syllables).\nflesch({sentence: 1, word: 12, syllable: 23}) // =\u003e 32.50499…\n```\n\n## API\n\nThis package exports the identifier `flesch`.\nThere is no default export.\n\n### `flesch(counts)`\n\nGiven an object containing the number of words (`word`), the number of\nsentences (`sentence`), and the number of syllables  (`syllable`) in a\ndocument, returns the reading ease associated with the document.\n\n##### `counts`\n\nCounts from input document.\n\n###### `counts.sentence`\n\nNumber of sentences (`number`, required).\n\n###### `counts.word`\n\nNumber of words (`number`, required).\n\n###### `counts.syllable`\n\nNumber of syllables (`number`, required).\n\n##### Returns\n\nResult is `120` (every sentence consisting of only two one-syllable words) or\nlower (including negative values).\n\nThe values have the following semantics:\n\n|     Score    | Semantics                                           |\n| :----------: | :-------------------------------------------------- |\n| 90.0 – 100.0 | Easily understood by an average 11-year-old student |\n|  60.0 – 70.0 | Easily understood by 13- to 15-year-old students    |\n|  0.0 – 30.0  | Best understood by university graduates             |\n\nTherefore we can use the following formula to approximate the average age a\nstudent would understand a document at, given score `score`:\n\n```js\nconst age = 20 - Math.floor(score / 10)\n```\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type `Counts`.\n\n## Compatibility\n\nThis package is at least compatible with all maintained versions of Node.js.\nAs of now, that is Node.js 14.14+ and 16.0+.\nIt also works in Deno and modern browsers.\n\n## Related\n\n*   [`automated-readability`](https://github.com/words/automated-readability)\n    — uses character count instead of error-prone syllable parser\n*   [`coleman-liau`](https://github.com/words/coleman-liau)\n    — uses letter count instead of an error-prone syllable parser\n*   [`dale-chall-formula`](https://github.com/words/dale-chall-formula)\n    — uses a dictionary, suited for higher reading levels\n*   [`flesch-kincaid`](https://github.com/words/flesch-kincaid)\n    — like `flesch`, returns U.S. grade levels\n*   [`gunning-fog`](https://github.com/words/gunning-fog)\n    — uses syllable count, needs POS-tagging and NER\n*   [`smog-formula`](https://github.com/words/smog-formula)\n    — like `gunning-fog-index`, without needing advanced NLP\n*   [`spache-formula`](https://github.com/words/spache-formula)\n    — uses a dictionary, suited for lower reading levels\n\n## Contribute\n\nYes please!\nSee [How to Contribute to Open Source][contribute].\n\n## Security\n\nThis package is safe.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/words/flesch/workflows/main/badge.svg\n\n[build]: https://github.com/words/flesch/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/words/flesch.svg\n\n[coverage]: https://codecov.io/github/words/flesch\n\n[downloads-badge]: https://img.shields.io/npm/dm/flesch.svg\n\n[downloads]: https://www.npmjs.com/package/flesch\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/flesch.svg\n\n[size]: https://bundlephobia.com/result?p=flesch\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[contribute]: https://opensource.guide/how-to-contribute/\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[formula]: https://en.wikipedia.org/wiki/Flesch–Kincaid_readability_tests#Flesch_Reading_Ease\n\n[syllable]: https://github.com/words/syllable\n","funding_links":["https://github.com/sponsors/wooorm"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwords%2Fflesch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwords%2Fflesch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwords%2Fflesch/lists"}