CIT 591 Readability, Corrections, clarifications, suggestions
Fall 2009, David Matuszek

As I feared, there are significantly more problems than usual with this assignment.


  1. Dr. Dietz noticed that the functions that only return precomputed values--getTotalSentenceCount, getTotalWordCount, getTotalComplexWordCount, and getTotalLetterCount--have no need for a parameter, and in fact shouldn't have one.
  2. To save a lot of problems in grading, I have to add a rule to the syllable counting algorithm: Every word has at least one syllable. That is, there are no zero-syllable words.


  1. I defined a "word" as "any sequence of consecutive letters." Words don't have to be separated by whitespace. "He-who-must-not-be-named" should be counted as six words.
  2. When counting how many times a word occurs, capitalization is not relevant. "The" and "the" and "THE" are all the same word.


I created a number of additional "helper" functions (all of which have corresponding tests), in order to help me write the required functions. You do not have to write these functions; but if you are having trouble, you might get some useful ideas from these.

Returns the position of the first sentence terminator (period, exclamation point, or question mark) in the string, or None if no terminator can be found.
Returns True if there is at least one letter somewhere in the string.
Returns a string with all the apostrophes (single quotes) removed from the input string, and all non-letters replaced with blanks.
Returns a string with all sequences of whitespace (multiple blanks, newlines, tabs) replaced by a single space, and stripped (whitespace removed from both ends).
Removes ed, es, and e (unless preceded by l) from the word.
Returns a list of all words, lowercased, in the string. (This function takes any string, calls some other functions to get just the words and normalize all the whitespace, then splits the result into a list of individual words. This function is used by getWordCount, getComplexWordCount, getSyllableCount, and getLetterCount.)
Returns the number of vowel sequences in the word. y is counted as a vowel, unless it is the first letter.

Unit testing

As mentioned in lab, if you put the following code at the bottom of your program, you can run the main() function by hitting F5 while editing the program, or load it and not run the main() function if you hit F5 while editing the test file.

if __name__ == '__main__':

Here are some of the things that have given me trouble; maybe they are giving you trouble too.