Git Product home page Git Product logo

cs50-readability's Introduction

Readability Index

readability-score

This program computes the approximate grade level needed to comprehend some text. For instance, E.B.White's "Charlotte's Web" is between a second and fourth grade reading level, while "The Great Gatsby" by F.Scott Fitzgerald is between ninth and twelveth grade reading level. But how might one go about deciding the grade levels of books and texts? What constitutes as being at higher reading levels? One might guess longer words and sentences would correlate with higher reading levels. Over the years, a number of 'readability tests' have been developed by experts and in this program, I am using Coleman-Liau index.

Coleman-Liau Index

This readability test is designed to output the U.S. grade level needed to understand a given text. The formula is:

index = 0.0588 * L - 0.296 * S - 15.8

Here, L is the average number of letters per 100 words in the text, and S is the average number of sentences per 100 words in the text.

For instance, if user types in a line from Dr. Seuss:

$ ./readability
Text: Congratulations! Today is your day. You're off to Great Places! You're off and away!
Grade 3

The text the user inputted has 65 letters, 4 sentences, and 14 words. 65 letters per 14 words is an average of about 464.29 letters per 100 words. And 4 sentences per 14 words is an average of about 28.57 sentences per 100 words. Plugged into the Coleman-Liau formula, and rounded to the nearest whole number, we get an answer of 3: so this passage is at a third grade reading level.

How to run the programs?

  1. Compile by running make readability or clang -o readability readability.c -lcs50 in terminal
  2. Run the program by running ./readability

Word of caution when compiling

You must install CS50 library for C in order to compile and link it using -lcs50 flag. Installation guide is here.

cs50-readability's People

Contributors

joseph-gansukh avatar

Watchers

James Cloos avatar  avatar

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.