It has come to my attention that there are two errors in Chapter 2, Replacing and Correcting Words of Python Text Processing with NLTK Cookbook. My thanks to the reader who went out of their way to verify my mistakes and send in corrections.
In Lemmatizing words with WordNet, on page 29, under How it works…, I said that “cooking” is not a noun and does not have a lemma. In fact, cooking is a noun, and as such is its own lemma. Of course, “cooking” is also a verb, and the verb form has the lemma “cook”.
In Removing repeating characters, on page 35, under How it works…, I explained the repeat_regexp
match groups incorrectly. The actual match grouping of the word “looooove” is (looo)(o)o(ve)
because the pattern matching is greedy. The end result is still correct.