This is the personal website of John Watson: father, software developer, artist, guitar player. Follow or contact me on Google+ or Twitter or GitHub or Facebook.

FD Word Statistics Plugin for WordPress


Please consider making a donation if you find this plugin useful.

DownloadRate itMy other plugins

Overview

Shows readability of the post currently being edited using three different readability measurements and also includes a word and sentence count.

Readability analysis is an attempt to show how difficult a text is to read. There are several methods of doing readability analysis. The most popular methods are used here. The Flesch and Flesch-Kincaid methods use formulas based on the average number of words per sentence and the average number of syllables per word. The Gunning-Fog method uses a formula based on the average number of words per sentence and the percentage of “hard” words (words with 3 or more syllables) in the passage.

Wordstats screenshot

Both the Gunning-Fog and the Flesch-Kincaid give a score that is the number of years of education the reader must have completed to understand the text. Different types of writing calls for different scores. Technical subjects may require a higher level of education so a higher Fog or Kincaid score is acceptable. Informal writing may try for a score in the 7-10 range. The Flesch score is a percentage. The higher the value, the better the readability.

Some sample scores:

Include taxable interest from seller-financed mortgages, banks, savings and loan associations, money market certificates, credit unions, savings bonds, etc. Interest credited in 2003 on deposits that you could not withdraw because of the bankruptcy or insolvency of the financial institution may not have to be included in your 2003 income. (IRS 1040 instructions)
Gunning-Fog: 19.6, Flesh-Kincaid: 15.6, Flesh: 26

The aroma arrived in force on Tuesday, as the plant resumed operations after losing power during Hurricane Frances, leaving a buildup of bacteria and adding malodor to the ill winds of the storm that struck over the weekend. It was yet another example of how vast power losses and infrastructure problems are defining what in hurricane country is known simply as “the aftermath.” (NYTimes.com)
Gunning-Fog: 20.2, Flesh-Kincaid: 16.2, Flesh: 35

I could not be happier, I finally got my MX900 bluetooth mouse working correctly on Mac OS X. To clarify, it always worked but I had 5 buttons that were just there for decoration, and I really missed the back and forward buttons. The magic application that made my day? Gamepad Companion. I tried a couple of others, including the awful Logitech software, and nothing even came close to working. (PhotoMatt.net)
Gunning-Fog: 10.7, Flesh-Kincaid: 7.9, Flesh: 63

Requirements

  • WordPress 2.0 or higher.
  • You can user version 0.81beta of the plugin with WordPress 1.5 or higher.

Installation

To install the plugin:

  • Copy fdwordstats.php to the wp-content/plugins directory.
  • Activate the plugin from the Plugins tab in WordPress.

Usage

Nothing special needs to be done other than the installation to use the plugin. The plugin will automatically display readability statistics in WordPress whenever you edit or save (and continue editing) a post. Hover the mouse over the statistics to see a brief description.

The plugin also defines several new template commands that you can use:

wordstats_words
Returns a count of words
wordstats_sentences
Returns a count of sentences
wordstats_fog
Returns the Gunning-Fog index
wordstats_flesch_kincaid
Returns the Flesch-Kincaid index
wordstats_flesch
Returns the Flesch index

Each of these functions takes one argument, the text to be analyzed. For example:

<?php echo wordstats_words(get_the_content()) ?>

Known issues

The syllable and sentence counting functions could use some improvements to handle special cases. Also, the hard words counting algorithm doesn’t take any exceptions into account. Sometimes the counts are off but it shouldn’t affect the statistics too much.

Don’t expect the readability indexes to match up with anyone else’s readability indexes. Different tools all use slightly different counting algorithms and thus will all give slightly different numbers. Your best bet is to use the numbers to see how changes you make are improving your text relative to older versions. For example, if you can increase the Flesch index then you are theoretically improving readability.

License

Copyright (C) 2004 John Watson

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Version history

  • 0.8 beta Wed Sep 01 2004 Initial release
  • 0.81 beta Wed Sep 07 2004 Minor documentation update
  • 1.0 Fri Dec 30 2005
    • Upgraded to work with WordPress 2.0
    • Changed template functions to return values rather than echo them. So now you can do things like <?php printf('Flesh index: %0.1f', wordstats_flesch_kincaid(get_the_content())) ?> in your templates.
  • 1.1 Fri Mar 28 2008 Cosmetic changes (name + docs). No functionality changes.
  • 1.2 Thu Dec 11 2008 Changed the visual style to match WordPress 2.7. This version remains compatible with older versions of WordPress.