Build a readability index The Flesch-Kincaid readability algorithm depends on the measures of word count and syllable count, neither of which is entirely objective, or easily automatable using a computer. For example, does "code-golf", with the hyphen, count as one word or two? Is the word "million" two or three syllables? In this task, you will need to approximate, as counting exactly will take too much time, space, and most importantly, code.

Your task is to build the smallest possible program (i.e. a function) in any language that will take an English reading passage (assumed to be in complete sentences), and calculate the Flesch Reading Ease index to a tolerance of eight points (to account for variations in syllable counting and word counting). It is calculated as follows:

FRE = 206.835 - 1.015 * (words per sentence) - 84.6 * (syllables per word)


Your program must be aligned to the reference passages below, whose indices were calculated using manual counting:

I would not, could not, in the rain.
Not in the dark, not on a train.
Not in a car, not in a tree.
I do not like them, Sam, you see.
Not in a house, not in a box.
Not with a mouse, not with a fox.
I will not eat them here or there.
I do not like them anywhere!


Index: 111.38 (64 syllables in 62 words in 8 sentences)

It was a bright cold day in April, and the clocks were striking thirteen.
Winston Smith, his chin nuzzled into his breast in an effort to escape
the vile wind, slipped quickly through the glass doors of Victory Mansions,
though not quickly enough to prevent a swirl of gritty dust from entering
along with him.


Index: 65.09 (74 syllables in 55 words in 2 sentences)

When in the Course of human events, it becomes necessary for one people to
dissolve the political bands which have connected them with another, and to
assume among the powers of the earth, the separate and equal station to
which the Laws of Nature and of Nature's God entitle them, a decent respect
to the opinions of mankind requires that they should declare the causes
which impel them to the separation.


Index: 3.70 (110 syllables in 71 words in 1 sentence)

If you have any other passages for which you have manually counted the syllables and words and calculated the index, you may show them as verification.
Perl 120 bytes

#!perl -pa0
s@\w+|([.!?])@$s+=$#-,lc($&amp;)=~s![aeiou]+\B|([aeiouy]$)!$y+=1-$#-/3!ger@ge}
{$_=206.835-1.015*@F/$s-84.6*$y/@F


Sample I/O:

$ perl flesch-kincaid.pl &lt; input1.dat
110.730040322581

$ perl flesch-kincaid.pl &lt; input2.dat
65.6097727272728

$ perl flesch-kincaid.pl &lt; input2.dat
1.71366197183096


Counting of syllables is done by assuming that each vowel cluster is a single syllable, except for lone vowels at the end of a word, which are only counted two thirds of the time; a heuristic that seems to be fairly accurate.