{"id":20660979,"url":"https://github.com/liatemplates/textanalysis","last_synced_at":"2026-04-27T03:31:11.576Z","repository":{"id":107256853,"uuid":"378684144","full_name":"LiaTemplates/TextAnalysis","owner":"LiaTemplates","description":"Runs different metrics against a text","archived":false,"fork":false,"pushed_at":"2021-06-21T09:36:08.000Z","size":249,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-26T15:07:41.410Z","etag":null,"topics":["liascript","liascript-template","oer","style","text-analysis"],"latest_commit_sha":null,"homepage":"https://liascript.github.io/course/?https://raw.githubusercontent.com/liaTemplates/TextAnalysis/main/README.md","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LiaTemplates.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-20T15:54:05.000Z","updated_at":"2022-02-22T10:59:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec6470f4-fc57-4a17-8014-a1d3a3792c73","html_url":"https://github.com/LiaTemplates/TextAnalysis","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/LiaTemplates/TextAnalysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FTextAnalysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FTextAnalysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FTextAnalysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FTextAnalysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LiaTemplates","download_url":"https://codeload.github.com/LiaTemplates/TextAnalysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LiaTemplates%2FTextAnalysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32321289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["liascript","liascript-template","oer","style","text-analysis"],"created_at":"2024-11-16T19:06:42.544Z","updated_at":"2026-04-27T03:31:11.558Z","avatar_url":"https://github.com/LiaTemplates.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\nauthor:   André Dietrich\n\nemail:    LiaScript@web.de\n\nversion:  0.0.1\n\nlanguage: en\n\nnarrator: US English Female\n\nscript:   https://cdn.jsdelivr.net/gh/liatemplates/textanalysis@0.0.1/dist/index.js\n\n@Textanalysis.full: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\",\"fleschReadingEase\", \"fleschKincaid\", \"gunningFog\", \"smog\", \"automatedReadabilityIndex\", \"colemanLiau\", \"linsearWrite\", \"daleChall\", \"readabilityconsensus\", \"readingtime\", \"speakingtime\"]`)\n\n@Textanalysis.FULL: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\",\"FleschReadingEase\", \"FleschKincaid\", \"GunningFog\", \"Smog\", \"AutomatedReadabilityIndex\", \"ColemanLiau\", \"LinsearWrite\", \"DaleChall\", \"Readabilityconsensus\", \"Readingtime\", \"Speakingtime\"]`)\n\n@Textanalysis.time: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\", \"readingtime\", \"speakingtime\"]`)\n\n@Textanalysis.TIME: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\", \"Readingtime\", \"Speakingtime\"]`)\n\n@Textanalysis.base: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\", \"readabilityconsensus\"]`)\n\n@Textanalysis.BASE: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\", \"Readabilityconsensus\"]`)\n\n@Textanalysis.check\n\u003cscript\u003e\nvar checks = @0\nvar text = `@input`\n\nfor(var i=0; i\u003c checks.length; i++) {\n  console.html(window.Textanalysis(checks[i], text))\n}\n\n\"\"\n\u003c/script\u003e\n\n@end\n\n--\u003e\n\n# TextAnalysis - Template\n\n              --{{0}}--\nThis document defines basic text analysis functions macros for static text\nanalysis to determine readability, complexity and grade level of a particular\ntext. It is mainly based on the JavaScript package\n[text-readability](https://www.npmjs.com/package/text-readability) and the\nprovided macros are intended to be used in trainig writing, to give students\ninstant feedback for written texts. All macros/tests can be added to\n[LiaScript](https://LiaScript.github.io) code-blocks to make them editable.\n\n__Try it on LiaScript:__\n\nhttps://liascript.github.io/course/?https://raw.githubusercontent.com/liaTemplates/TextAnalysis/main/README.md\n\n__See the project on Github:__\n\nhttps://github.com/liaTemplates/TextAnalysis\n\n              --{{1}}--\nThere are three ways to use this template. The easiest way is to use the\n`import` statement and the url of the raw text-file of the master branch or any\nother branch or version. But you can also copy the required functionionality\ndirectly into the header of your Markdown document, see therefor the [last\nslide](#implementation). And of course, you could also clone this project and\nchange it, as you wish.\n\n           {{1}}\n1. Load the macros via\n\n   `import: https://raw.githubusercontent.com/liaTemplates/TextAnalysis/main/README.md`\n\n2. Copy the definitions into your Project\n\n3. Clone this repository on GitHub\n\n## `@Textanalysis.check`\n\n\n                    --{{0}}--\nThere is one simple macro that runs all defined tests, it is\n`@Textanalysis.check`. It has to be attached to your Markdown code-block. It\nreceives only one parameter, which is a list of strings, put into a verbatim\nelements (single backticks \\`). The order of strings also define the order of\ntests to be executed. Furthermore, if the command-string starts with a lower\ncase, only a simple value/result gets returned, with upper case you will get\nalso more information about the specific value and how it has to be interpreted.\n\n\n```` Markdown\n``` text\nPlaying games has always been thought to be important to\nthe development of well-balanced and creative children;\nhowever, what part, if any, they should play in the lives\nof adults has never been researched that deeply. I believe\nthat playing games is every bit as important for adults\nas for children. Not only is taking time out to play games\nwith our children and other adults valuable to building\ninterpersonal relationships but is also a wonderful way\nto release built up tension.\n```\n@Textanalysis.check(`[words\", \"syllables\", \"sentences\"]`)\n````\n\n---\n\n``` text\nPlaying games has always been thought to be important to\nthe development of well-balanced and creative children;\nhowever, what part, if any, they should play in the lives\nof adults has never been researched that deeply. I believe\nthat playing games is every bit as important for adults\nas for children. Not only is taking time out to play games\nwith our children and other adults valuable to building\ninterpersonal relationships but is also a wonderful way\nto release built up tension.\n```\n@Textanalysis.check(`[\"words\", \"syllables\", \"sentences\"]`)\n\n### List of tests\n\nCurrently you can select all of the following tests. For more information see\nthe source-code in\n[src/index.js](https://github.com/LiaTemplates/TextAnalysis/blob/main/src/index.js).\n\n* `automatedReadabilityIndex`:\n\n  Returns the ARI (Automated Readability Index) which outputs a number that\n  approximates the grade level needed to comprehend the text.\n\n  For example if the ARI is 6.5, then the grade level to comprehend the text is\n  6th to 7th grade.\n\n  | Score | Age   | Grade Level        |\n  | ----- | ----- | ------------------ |\n  | 1     | 5-6   | Kindergarten       |\n  | 2     | 6-7   | First/Second Grade |\n  | 3     | 7-9   | Third Grade        |\n  | 4     | 9-10  | Fourth Grade       |\n  | 5     | 10-11 | Fifth Grade        |\n  | 6     | 11-12 | Sixth Grade        |\n  | 7     | 12-13 | Seventh Grade      |\n  | 8     | 13-14 | Eighth Grade       |\n  | 9     | 14-15 | Ninth Grade        |\n  | 10    | 15-16 | Tenth Grade        |\n  | 11    | 16-17 | Eleventh Grade     |\n  | 12    | 17-18 | Twelfth grade      |\n  | 13    | 18-24 | College student    |\n  | 14    | 24+   | Professor          |\n\n  [Wikipedia: Automated readability index](https://en.wikipedia.org/wiki/Automated_readability_index)\n\n* `colemanLiauIndex`:\n\n  This is a grade formula in that a score of 9.3 means that a ninth grader would\n  be able to read the document.\n\n  [Wikipedia: Coleman–Liau index](https://en.wikipedia.org/wiki/Coleman%E2%80%93Liau_index)\n\n* `daleChallReadabilityScore`:\n\n  Different from other tests, since it uses a lookup table of the most commonly\n  used 3000 English words. Thus it returns the grade level using the New\n  Dale-Chall Formula.\n\n  | Score        | Notes                                                                |\n  | ------------ | -------------------------------------------------------------------- |\n  | 4.9 or lower | easily understood by an average 4th-grade student or lower           |\n  | 5.0–5.9      | easily understood by an average 5th or 6th-grade student             |\n  | 6.0–6.9      | easily understood by an average 7th or 8th-grade student             |\n  | 7.0–7.9      | easily understood by an average 9th or 10th-grade student            |\n  | 8.0–8.9      | easily understood by an average 11th or 12th-grade student           |\n  | 9.0–9.9      | easily understood by an average 13th to 15th-grade (college) student |\n\n  [Wikipedia: Dale–Chall readability formula](https://en.wikipedia.org/wiki/Dale%E2%80%93Chall_readability_formula)\n\n* `fleschKincaidGrade`:\n\n  This is a grade formula in that a score of 9.3 means that a ninth grader would\n  be able to read the document.\n\n  [Wikipedia: Flesch–Kincaid grade level](https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests#Flesch%E2%80%93Kincaid_grade_level)\n\n\n* `fleschReadingEase`:\n\n  While the maximum score is 121.22, there is no limit on how low the score can\n  be. A negative score is valid.\n\n  | Score  | Difficulty       |\n  | ------ | ---------------- |\n  | 90-100 | Very Easy        |\n  | 80-89  | Easy             |\n  | 70-79  | Fairly Easy      |\n  | 60-69  | Standard         |\n  | 50-59  | Fairly Difficult |\n  | 30-49  | Difficult        |\n  | 0-29   | Very Confusing   |\n\n  [Wikipedia: Flesch reading ease](https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests#Flesch_reading_ease)\n\n* `gunningFog`:\n\n  This is a grade formula in that a score of 9.3 means that a ninth grader would\n  be able to read the document.\n\n  | Fog Index | Reading level by grade |\n  | --------- | ---------------------- |\n  | 17        | College graduate       |\n  | 16        | College senior         |\n  | 15        | College junior         |\n  | 14        | College sophomore      |\n  | 13        | College freshman       |\n  | 12        | High school senior     |\n  | 11        | High school junior     |\n  | 10        | High school sophomore  |\n  | 9         | High school freshman   |\n  | 8         | Eighth grade           |\n  | 7         | Seventh grade          |\n  | 6         | Sixth grade            |\n\n\n  [Wikipedia: Gunning fog index](https://en.wikipedia.org/wiki/Gunning_fog_index)\n\n* `linsearWriteFormula`:\n\n  This is a grade formula in that a score of 9.3 means that a ninth grader would\n  be able to read the document.\n\n  It is a readability metric for English text, purportedly developed for the\n  United States Air Force to help them calculate the readability of their\n  technical manuals. It is specifically designed to calculate the United States\n  grade level of a text sample based on sentence length and the number of words\n  used that have three or more syllables.\n\n  [Wikipedia: Linsear Write](https://en.wikipedia.org/wiki/Linsear_Write)\n\n* `readabilityConsensus`:\n\n  Based upon \"Dale-Chall Readability Score\", \"Linsear Write Formula\",\n  \"Coleman-Liau Index\", \"Automated Readability Index\", \"SMOG Index\", \"Fog\n  Scale\", \" Flesch-Kincaid Grade Level\", \"Flesch Reading Ease formula\", returns\n  the estimated school grade level required to understand the text.\n\n* `sentences`: Returns the number of sentences present in the given text.\n\n* `smogIndex`:\n\n  This is a grade formula in that a score of 9.3 means that a ninth grader would\n  be able to read the document.\n\n  Texts of fewer than 30 sentences are statistically invalid, because the SMOG\n  formula was normed on 30-sentence samples. textstat requires atleast 3\n  sentences for a result.\n\n  [Wikipedia: SMOG](https://en.wikipedia.org/wiki/SMOG)\n\n* `syllables`: Returns the number of syllables present in the given text.\n\n* `words`: Calculates the number of words present in the text.\n  (Punctuation is not taken into account)\n\n* `readingTime`:\n\n  The speed at which subjects read a text aloud tend varies between 228±30 words\n  per minute for English. While proofreading materials, people are able to read\n  English at 200 words per minute on paper, and 180 words per on a monitor.\n\n  [Wikipedia: Reading and comprehension](https://en.wikipedia.org/wiki/Words_per_minute#Reading_and_comprehension)\n\n* `speakingtime`:\n\n  Audiobooks are recommended to be 150–160 words per minute, which is the range\n  that people comfortably hear and vocalize words. Slide presentations tend to\n  be closer to 100–125 words per minute for a comfortable pace.\n\n  [Wikipedia: Speech and listening](https://en.wikipedia.org/wiki/Words_per_minute#Speech_and_listening)\n\n## `@Textanalysis.full`\n\n    --{{0}}--\nThe following macro runs all tests and gives an returns only the short results.\n\n``` text\nPlaying games has always been thought to be important to\nthe development of well-balanced and creative children;\nhowever, what part, if any, they should play in the lives\nof adults has never been researched that deeply. I believe\nthat playing games is every bit as important for adults\nas for children. Not only is taking time out to play games\nwith our children and other adults valuable to building\ninterpersonal relationships but is also a wonderful way\nto release built up tension.\n```\n@Textanalysis.full\n\n\n## `@Textanalysis.FULL`\n\n    --{{0}}--\nUse this macro to run all tests an provide more information on how the details\nhave to interpreted.\n\n``` text\nPlaying games has always been thought to be important to\nthe development of well-balanced and creative children;\nhowever, what part, if any, they should play in the lives\nof adults has never been researched that deeply. I believe\nthat playing games is every bit as important for adults\nas for children. Not only is taking time out to play games\nwith our children and other adults valuable to building\ninterpersonal relationships but is also a wonderful way\nto release built up tension.\n```\n@Textanalysis.FULL\n\n\n## `@Textanalysis.time` \u0026 `@Textanalysis.TIME`\n\n    --{{0}}--\nThe two time macros can be used to estimate the reading and speaking time for\ndifferent contexts.\n\n``` text\nPlaying games has always been thought to be important to\nthe development of well-balanced and creative children;\nhowever, what part, if any, they should play in the lives\nof adults has never been researched that deeply. I believe\nthat playing games is every bit as important for adults\nas for children. Not only is taking time out to play games\nwith our children and other adults valuable to building\ninterpersonal relationships but is also a wonderful way\nto release built up tension.\n```\n@Textanalysis.time\n\n``` text\nPlaying games has always been thought to be important to\nthe development of well-balanced and creative children;\nhowever, what part, if any, they should play in the lives\nof adults has never been researched that deeply. I believe\nthat playing games is every bit as important for adults\nas for children. Not only is taking time out to play games\nwith our children and other adults valuable to building\ninterpersonal relationships but is also a wonderful way\nto release built up tension.\n```\n@Textanalysis.TIME\n\n\u003e **Note:** This could be improved in the future by combining this with the\n\u003e calculated reading complexity for different use-cases:\n\u003e **(1 grade \u0026 slower reading time)**\n\n## Examples\n\n\n``` text Obama, Farewell Speech\nOn Tuesday, January 10, I’ll go home to Chicago to say my\ngrateful farewell to you, even if you can’t be there in\nperson.\n\nI’m just beginning to write my remarks. But I’m thinking\nabout them as a chance to say thank you for this amazing\njourney, to celebrate the ways you’ve changed this country\nfor the better these past eight years, and to offer some\nthoughts on where we all go from here.\n\nSince 2009, we’ve faced our fair share of challenges, and\ncome through them stronger. That’s because we have never\nlet go of a belief that has guided us ever since our\nfounding — our conviction that, together, we can change\nthis country for the better. So I hope you’ll join me one\nlast time.\n```\n@Textanalysis.base\n\n\n``` text Trump, Presidential Bid announcement\nThank you. It’s true, and these are the best and the\nfinest. When Mexico sends its people, they’re not sending\ntheir best. They’re not sending you. They’re not sending\nyou. They’re sending people that have lots of problems, and\nthey’re bringing those problems with us. They’re bringing\ndrugs. They’re bringing crime. They’re rapists. And some,\nI assume, are good people.\n\nBut I speak to border guards and they tell us what we’re\ngetting. And it only makes common sense. It only makes\ncommon sense. They’re sending us not the right people.\n```\n@Textanalysis.base\n\n## Implementation\n\n``` html\nscript:   ./dist/index.js\n\n@Textanalysis.full: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\",\"fleschReadingEase\", \"fleschKincaid\", \"gunningFog\", \"smog\", \"automatedReadabilityIndex\", \"colemanLiau\", \"linsearWrite\", \"daleChall\", \"readabilityconsensus\", \"readingtime\", \"speakingtime\"]`)\n\n@Textanalysis.FULL: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\",\"FleschReadingEase\", \"FleschKincaid\", \"GunningFog\", \"Smog\", \"AutomatedReadabilityIndex\", \"ColemanLiau\", \"LinsearWrite\", \"DaleChall\", \"Readabilityconsensus\", \"Readingtime\", \"Speakingtime\"]`)\n\n@Textanalysis.time: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\", \"readingtime\", \"speakingtime\"]`)\n\n@Textanalysis.TIME: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\", \"Readingtime\", \"Speakingtime\"]`)\n\n@Textanalysis.base: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\", \"readabilityconsensus\"]`)\n\n@Textanalysis.BASE: @Textanalysis.check(`[\"words\", \"syllables\", \"sentences\", \"Readabilityconsensus\"]`)\n\n@Textanalysis.check\n\u003cscript\u003e\nvar checks = @0\nvar text = `@input`\n\nfor(var i=0; i\u003c checks.length; i++) {\n  console.html(window.Textanalysis(checks[i], text))\n}\n\n\"\"\n\u003c/script\u003e\n\n@end\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliatemplates%2Ftextanalysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliatemplates%2Ftextanalysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliatemplates%2Ftextanalysis/lists"}