flagrantdisregard

FD Word Statistics Plugin for WordPress

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.

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.

9 Responses to “FD Word Statistics Plugin for WordPress”

  1. eddy says:

    nice plugin tnx

  2. NSpeaks says:

    Can you include a feature to count characters too in it?

  3. NSpeaks says:

    Can you suggest a template tag example to count words in a post where I can display that tag in my single post file of wordpress?

  4. NSpeaks says:

    I tried using post_content); ?>

    But it didn’t work.

  5. John says:

    Try using this in your template (in The Loop): <?php echo wordstats_words(get_the_content()) ?>

    Probably won’t add character counting because it doesn’t seem very useful. I’m willing to be convinced though.

  6. NSpeaks says:

    Never mind I managed to include character count feature in your plugin for my use. Also I managed to create the corresponding template tag for it.

    And thanks for the post tag link link. I found that even $post->post_content worked for showing content of post.

  7. MayaAndMarketability.com says:

    Can you add an “Ego” word counter? When writing copy, people forget to write for the audience… so, their marketing message lean heavy around talking about themselves (the ego). I think seeing stats about how many times my company name, company url, the word “I”, etc. (Ego words) are used in text can help improve how businesses write for their audience. Thoughts?

  8. John says:

    That’s an interesting idea. Do you propose having an interface that allows you to define what the ego words are?

  9. Megapixels says:

    Great stuff, just what I was looking for. I was used to writing stuff for ezinearticles, and got really attached to the word counter on the submit an article screen. Their word count updated while I was typing, which was kind of nice. Although, they didn’t have the readability scores and sentence count, which is pretty sweet. Thanks.

Leave a Reply