When you are writing something like article, text, document etc you are focusing on readability. If you are not then you should. As readability influence how a reader can read and understand the content, how you are presenting the content etc. It would also influence how much likely one is to share your article as well. To find the readability there are a lot of statistical tests. Few are listed below.

  • Flesch-Kincaid readability test
  • Flesch Kincaid Grade Level

  • Gunning Fog Score

  • SMOG

  • Coleman Liau Index

  • Automated Readability Index (ARI)

Recently in a project that we worked on we were asked to find the readability of various pages of a website. We decided to start with Flesch-Kincaid test, as we found this to be a popular one in our research.

Flesch-Kincaid readability test is designed to indicate how difficult a passage in English is to understand. In this test higher score indicates how easier to read and a lower score indicates how difficult it is to read.The formula to find Flesch-Kincaid reading-ease score is

206.835 – 1.015 * (total words / total sentences) – 84.6 * (total syllables / total words)

The scores can be interrupted as

Score School Level Notes
100.00-90.00 5th grade Very easy to read.
90.00-80.00 6th grade Easy to read.
80.00-70.00 7th grade Fairly easy to read.
70.00-60.00 8th & 9th grade Plain English.
60.00-50.00 10th to 12th grade Fairly difficult to read.
50.00-30.00 College Difficult to read.
30.00-0.00 College Graduate Very difficult to read.



Since we were not experts we wanted the ability to tweak and play around with it. We found an already build gem called Odyssey which had all these various tests and also provided the ability to extend this feature as well. So here in this article, we will discuss how to use Odyssey gem to find readability of an article and a web page.

Install Odyssey

Add in your Gemfile.


So if we want to use the Flesch-Kincaid test, we write the code as below.

To find the readability of a website we use Nokogiri and Odyssey together. Nokogiri to fetch the contents of the page and Odyssey to get the readability.

Example of finding readability of our own website (https://redpanthers.co)

If all_stats is set to false, it returns score only. If it is true returns a hash like below

We can perform multiple text analyses on the same text as shown below

if all_stats is set to true it will return a hash like this

Extending odyssey

To extending odyssey, you can create a class that inherit from formula

To call your formula you just use

Resultant passage will be a Hash like this

and resultant status will be a Hash like this

Because we have access to formula’s class that is  ‘status’ flag set to true then we have access to other methods or class formula.

Thanks to Odyssey we were able to implement the feature quite easily and right now the algorithm we are using have evolved to new forms. But that’s another article. But if you want to build a simple readability checker then it’s quite easy and simple in Rails.