npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

readeasy

v0.0.109

Published

Easily test the readability of a text and suggest areas of improvement.

Downloads

10

Readme

Readeasy

Introduction

Please open an issue on Github if you want to ask me more about this. I really would like to know if others like the idea of this package and find it useful. This tests the readability of a text, and will soon also provide suggestions for improvement. It heirarchically calculates the readability of an article of a text as a whole, then separate paragraphs, then sentences, then words. When checking the readability of words it counts the syllables in a word and if the word has more syllables than specificed threshold it looks up the dictionary.com api to check for synonyms that are shorter.

Contents

Name

I searched for a name available on npm, which described the project and was easy enough to remember. Readability was the obvious choice, but that name is taken by the mozilla reading addon. I found that readeasy was available on npm, and thought this was brilliant due to how close it sounds to a speakeasy, which were drinking establishments where individuals were forced to speak softly in order to not offend the authorities with the awful practice of drinking.

Lacking the inordinate reverence for authority, whilst simultaneously admiring both the apt description and the sonorous sound of readeasy, I thought it to be a most appropriate name for this project.

Installation

npm i readeasy --save

Usage

const readeasy = require('readeasy')

let text = "Always use a shorter word where possible!"
let readability = readeasy(text)

console.log(readability)

Understanding

The below is a simplifed output of a test paragraph. Notice the heirarchical structure. The text is tested on the whole for readability but also has more readability for each paragraph(separated by a new line), each sentence(separated by a period) and every word(separted by a space).

{
  "score": 78.12031969309464,
  "schoolLevel": "7th grade",
  "notes": "Fairly easy to read.",
  "grade": 3.707544757033247,
  "paragraphs": [
    {
      "score": 76.06927648578812,
      "schoolLevel": "7th grade",
      "notes": "Fairly easy to read.",
      "grade": 3.8361240310077527,
      "text": "First Paragraph. This is to test the readability of text. Right now it only works for entire blocks of text. Soon I will fix it to divide by sentences so that it can provide hints about specific sentences that need might need simplifying.",
      "sentences": [
        {
          "score": 36.95833333333334,
          "schoolLevel": "college",
          "notes": "Difficult to read.",
          "grade": 8.270000000000003,
          "text": "First Paragraph.",
          "words": [
            {
              "text": "First",
              "syllables": 1
            },
            {
              "text": "Paragraph.",
              "syllables": 3
            }
          ]
        },
	...

Examples

You can get more fine grained information by subsetting the object such as in the examples below.

const readeasy = require('readeasy')

let text = "Always use a shorter word where possible!"
let readability = readeasy(text)

// The overall readability of the input text
console.log(readability.score)

// The readability of the second paragraph
console.log(readability.paragraphs[1].score)

// The approximate schoolLevel of the third sentence of the first paragraph
console.log(readability.paragraphs[0].sentences[2].schoolLevel)

// The number of syllables of the fourth word of the second sentence of the first paragraph
console.log(readability.paragraphs[0].sentences[1].words[3].syllables)

Future

In the future I plan to

  • Implement syntax parsing using SyntaxNet so that grammatical suggestions can also be made.
  • Integrate vocab statistics to get more intelligent data about word usage and make smarter vocabulary suggestions.
  • Improve readability metrics.