Exercise P6.11. Flesch Readability Index. The following index [6] was invented by Flesch as a simple tool to gauge the legibility of a document without linguistic analysis. . Count all words in the file. A word is any sequence of characters delimited by white space, whether or not it is an actual English word. . Count all syllables in each word. To make this simple, use the following rules: Each group of adjacent vowels {a,e,i,o,u,y} counts as one syllable (for example, the "ea" in "real" contributes one syllable, but the "e..a" in "regal" count as two syllables). However, an "e" at the end of a word doesn't count as a syllable. Also, each word has at least one syllable, even if the previous rules give a count of 0. . Count all sentences. A sentence is ended by a period, colon, semicolon, question mark, or exclamation mark. . The index is computed by index = 206.835 - 84.6 x (Number of syllables / Number of words) - 1.015 x (Number of words / Number of sentences) rounded to the nearest integer. This index is a number, usually between 0 and 100, indicating how difficult the text is to read. Some examples for random material for various publications are Comics 95 Consumer ads 82 Sports Illustrated 65 Time 57 New York Times 39 Auto insurance policy 10 Internal Revenue Code -6 Translated into educational levels, the indices are 91-100 5th grader 81-90 6th grader 71-80 7th grader 66-70 8th grader 61-66 9th grader 51-60 High school student 31-50 College student 0-30 College graduate Less than 0 Law school graduate The purpose of the index is to force authors to rewrite their text until the index is high enough. This is achieved by reducing the length of sentences and by removing long words. For example, the sentence The following index was invented by Flesch as a simple tool to estimate the legibility of a document without linguistic analysis. can be rewritten as Flesch invented an index to check whether a text is easy to read. To compute the index, you need not look at the meaning of the words. His book [7] contains delightful examples of translating government regulations into "plain English". Your program should read in a text file, compute the legibility index, and print out the equivalent educational level.