Prog 5: SpeechGrade

3/21 Modified rules to only subtract one for adjacent vowels inside a word, to properly handle words like "flea".  Also combined rules 3 & 4 into an "if-else" rule to avoid subtracting two times for a word ending in "le". Hyphens ('-') should also separate words.  The letter 'Y' now counts as a vowel.

According to a October 20, 2015 Boston Globe article, Trump's presidential announcement speech "could have been comprehended by a fourth-grader" according to an algorithm called the Flesch-Kincaid (F-K) grade level test.  News articles are sometimes inflammatory, prone to exaggeration for the sake of generating interest.  So, is the claim about Trump's speech true?  How does Trump's presidential announcement speech compare to other candidates' announcement speeches? (Note that this is a separate issue from whether or not simpler is better!)

Comparing these speeches is our task for this assignment.  Take the recent presidential announcement speeches and print out a table of them according to the F-K grade level test, with the lowest grade level at the top of the list, and the highest grade-level at the bottom.  You should be able to compare your results at readability-score.com.  The F-K test (from this wikipedia page) is:

Words are separated from each other by whitespace (space, tab, or newline), or hyphen (respectively ASCII codes 32, 9, (10 or 13), 45)

The end of a sentence is denoted by a period, question mark or exclamation mark followed by whitespace or quotes.

You can count the number of syllables in words by using the following rules (modified from here) that aren't perfect, but get us pretty close:

The format of running the program should look like what is below, though the data here is made up and only the first 3 rows are shown:

Author: Dale Reed Program #5: SpeechGrade TA: Elliott Ness, T 6:00 AM March 12, 2016 System: XCode on Mac  Presidential Announcement Speech reading grade levels: 10.7 Graham, Linsey  8.5 Paul, Rand  8.0 Fiorina, Carly  . . .

See Speeches.zip for the presidential announcement speeches of the following 17 Democrats and Republicans:

JebBush

BenCarson

ChrisChristie

HillaryClinton

TedCruz

CarlyFiorina

LindseyGraham

MikeHuckabee

JohnKasich

RandPaul

RickPerry

MarcoRubio

BernieSanders

RickSantorum

DonaldTrump

ScottWalker

JamesWebb

I suggest you copy and paste the following names into an array so that you can handle each one individually. Just for fun (but no extra credit) you could also look at all the US Presidential inaugural addresses and see if/how grade level has changed over time.  All the inaugural addresses can be found at the UC Santa Barbara American Presidency Project 

Turning In Your Program

While you had the opportunity to work with a partner on programs 3 and 4, the remaining programs must be done independently.

Failing to follow these naming conventions and failure to turn in a single zip file will result in a 5 point deduction, even if everything else is perfect in your program.