|
Practical Common LispThus, you should capture both the classification and score returned by classify and then collect a list of the filename, the actual type, the type returned by classify, and the score. To make the results more human readable, you can include keywords in the list to indicate which values are which. (defun test-from-corpus (corpus &key (start 0) end) (loop for idx from start below (or end (length corpus)) collect (destructuring-bind (file type) (aref corpus idx) (multiple-value-bind (classification score) (classify (start-of-file file *max-chars*)) (list :file file :type type :classification classification :score score))))) A Couple of Utility Functions To finish the implementation of test-classifier, you need to write the two utility functions that don't really have anything particularly to do with spam filtering, shuffle-vector and start-of-file. An easy and efficient way to implement shuffle-vector is using the Fisher-Yates algorithm.[259] You can start by implementing a function, nshuffle-vector, that shuffles a vector in place ...» | Код для вставки книги в блог HTML
phpBB
текст
|
|