Giter Site home page Giter Site logo

clearnote01 / readability Goto Github PK

View Code? Open in Web Editor NEW
71.0 71.0 13.0 83 KB

npm package to calculate readability statistics of a text object - paragraphs, sentences, articles.

License: MIT License

JavaScript 99.96% HTML 0.04%
analytics readability statistics text

readability's People

Contributors

annakopp avatar clearnote01 avatar dependabot[bot] avatar garyo avatar hata6502 avatar helenb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

readability's Issues

BUG: sentenceCount function does not count sentences properly

Issue

The function sentenceCount uses this regular expression to calculate total sentences: (/ *[.?!]['")\]]*[ |\n](?=[A-Z])/g)

It works well when we have text separated by single \n but when there are multiple new lines in between the text, it does not split them properly.

Possible Fix

I suggest a fix: After getting sentences from regular expression mentioned above, we should split each by \n and consider each splitted string as new sentence if it's word count is greater than 3.

How did I find it?

I was matching text-readability fleschReadingEase score with some other tools like https://www.webfx.com/tools/read-able and https://charactercalculator.com/flesch-reading-ease/
There was a big difference in both scores, so I decided to look into library and found this issue in sentence counting part.

I would love to contribute and fix this, please assign me.

Feature Request: Provide a Readability Consensus score (based upon all tests), return the estimated school grade

Hey there,
First off, thanks for this awesome repo. I have a feat. request, as described in the title, which I'd like to directly use in one of my projects.

A function in which we can provide a Readability Consensus score (based upon all tests), and return the estimated school grade.

Reason

Building a grammar correction bot, and need to create an "average value" of its performance on multiple grammar fixes, and after that I want to describe the estimated school grade level needed to read the text.

Example:

On average, the **readability score** of your original documentation is **3.81** ("Fairly Difficult").
To keep it simple; a student between ${<<insert value here, e.g. "9th and 10th grade">>} can understand your documentation.

Using in simple HTML page

Hi,
I find no way to use it in a simpe html page (index.html)... no React, vo Vues. That's because my very low experience with es modules and how to use them in a browser.
Is there any example I can find somewhere?
Thank you!!!

Error due to unresolved package

I believe one further change is needed from the fix that was merged at #3

I installed the text-readability package direct from this repo, as the package was not up to date. I now see the following issue:

ERROR in ./node_modules/text-readability/main.js
Module not found: Error: Can't resolve 'fs' in '/Users/helen/repos/mq-take-part-research/node_modules/text-readability'

I believe the first line of main.js - const fs = require('fs') needs to be removed.

"TypeError: fs.readFileSync is not a function" in React

Hi,

Thank you for this amazing library. I am trying to use it in React (in browser) to analyze some text. Unfortunately filesystem doesn't work in browser so I get this error:
TypeError: fs.readFileSync is not a function

  12 | 
  13 | var punctuationRE = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-./:;<=>?@[\]^_`{|}~]/g;
  14 | var easyWordsPath = path.join(__dirname, 'easy_words.txt');
> 15 | var easyWords = fs.readFileSync(easyWordsPath, 'utf-8');
  16 | var easyWordSet = new Set(easyWords.split(/\n/g)); // extends Math object
  17 | 
  18 | Math.copySign = function (x, y) {

Update npm package

Hello!

Can you please publish a new release of the package with the updated dependencies?

syllable's old version has a security vulnerability in the trim package it uses.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.