Readability of text using odyssey


Bookmark and Share

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 …

Read More

Taking screenshots of webpages using Ruby


Bookmark and Share

Recently we have been working on taking screenshots for web page while generating reports based on that website. During this endeavor, we came across some tools to achieve that. We are sharing the information we gathered here.

The tools that we will discuss for screencapture, in  Ruby,  are:

  • PhantomJS
  • Screencap gem
  • Webshot gem

Screencap and webshot are gems in Ruby that depends on a tool called PhantomJS. It is basically a web browser without a user interface, primarily used for testing websites. Such type of browsers are generally referred to as headless browsers,

Screenshots with PhantomJS

PhantomJS is quite easy to install and is multiplatform, available on major operating systems.

To start, our script must require a reference to the webpage module then use it to create an instance:

Use the instance.open() method and pass it the arguments, the url of the webpage that we want to capture screenshot.

instance.render() method captures the screenshot and saves it to the file specified in the argument.
Run the script as,

Screenshot is saved in the  directory where we run the script.

Now what we have above is all JavaScript, but to use the phantom JS in our rails application we have gems that provide us with an easy interface to acheive the …

Read More

Chartkick: data visualization made easy with Ruby


Bookmark and Share

Recently, I’ve been using Highcharts, Google charts and Chart Js for visualizing dynamic data in my projects. But it was difficult to integrate it with the rails application. However, for every problem in Ruby, there is a gem out there to save your day and Chartkick, a Ruby gem exclusively available for data visualization is truly a savior. Chartkick can work with Highcharts, Chart.js and Google charts to create dynamic and interactive charts that draw data from the Rails application. And the best part, you just need to write one single line of Ruby code. Isn’t that amazing and powerful!

Let’s begin with Installation

For installation, all you have to do is adding this line to your application’s Gemfile:

Then you have to choose your charting library.
In case, if more than one charting library is loaded, choose between them with the following code:

P.S:- highcharts is the default adapter is nothing else is defined.

Using Chartkick

Once it’s installed, you can start playing around with chartkick. For example:

In the above example, I have just shown you how we can make a line chart.Similarly, you can create Pie chart, Column chart, Bar chart, Area chart, Scatter chart, Geo charts, Timeline(Google …

Read More