Problem 3 – Using Python to calculate text readability
In this section, we'll look at an application relating to linguistics, specifically the readability level of any text. We will be using Martin Luther King's I Have a Dream speech in the code snippets that follow. You can substitute this for any text file, so long as you change the location of the file and filename to be accurately reflected in the code. The full code can be found in the ch15_Readability.py
file.
Before we get into the code, let's talk first about what we're looking for and why it's important. Learning about the readability of texts can help us make decisions about whether or not to include them in a presentation, a school grade level, and much more. The Flesch-Kincaid score is used to determine readability and was developed in the 1940s.
Rudolf Flesch created it when working as a consultant with the Associated Press in an effort to improve the readability of newspapers. Originally...