A spam filter

Write a simple spam filter based on naive Bayes probability, following the steps outlined in A plan for Spam by Paul Graham. The article describes the problem and provides an outline of the method to be used. The article provides some Lisp code, and Paul Graham provides more useful Lisp code. You do not need to do this in Lisp, any language will work, but it is particularly simple to write it in Lisp.
Start from the program shown in Figure 8.3 pages 140-141 of the Graham ANSI Common Lisp book (You can get the software from Paul Graham's lisp code page). You'll need the functions read-text and see and the variable punc. The function read-text reads one word at a time, the function see updates the count of how many time a word has been seen, punc specifies pubctuation characters that should be considered as separate words.
To make life easy, I have already made the changes you need to Graham code,
Copyright: © 2016 by the Regents of the University of Minnesota
Department of Computer Science and Engineering. All rights reserved.
Comments to: Maria Gini
Changes and corrections are in red.