Unnit 9 - Lesson 9 String Algorithms bugs

In the version of TextProcessor.java that you have us copy if we don’t have that class in our backpack for the Choice Levels for #3, you’ve got the “row” loop variable (line 111) and the index loop variable (line 132) reversed. So there are compile errors.

I think you’ve got other problems with your sample TextProcessor.java. The findFrequentWord() method finds the most frequent line (not word). It looks like in several places you forgot to convert lines to lists of words before looking for word counts or word properties. jr

@jranta - Hi John, thanks for finding this error. I will pass it on to support@code.org. I found it in Unit 6 Lesson 9 Level 3C.

You may need to guide me a bit more on your second point. The findFrequentWord() from my inspection looks OK.
Thanks again for keeping us updated on errors or discrepancies you find.

Thanks for fixing that. The other problem I mentioned, that some of the other methods don’t work in your version of TextProcessor.java, is because your TextProcessor.java doesn’t include code to convert the “textList” instance variable to an Arraylist of words. As provided in your version of TextProcessor.java, textList is an Arraylist of lines. Nowhere in the various word-based methods do you provide code to build textList as a list of words, even though all those methods require words (not lines).
The easiest way to fix this might be to change this line in the constructor:
textList = FileReader.getStringData(filename); // makes an arraylist of lines
To this line:
textList = FileReader.getWords(filename); // makes an arraylist of words
Then all your other supplied methods to find/change/remove words in textList would work without modification.
Just a suggestion. jr

@jranta - Thank you! I will pass these along.