|
Practical Common LispSPAM> (classify "Make money fast") SPAM SPAM> (classify "Want to go to the movies?") UNSURE While ultimately all you care about is the classification, it'd be nice to be able to see the raw score too. The easiest way to get both values without disturbing any other code is to change classification to return multiple values. (defun classification (score) (values (cond ((<= score *max-ham-score*) 'ham) ((>= score *min-spam-score*) 'spam) (t 'unsure)) score)) You can make this change and then recompile just this one function. Because classify returns whatever classification returns, it'll also now return two values. But since the primary return value is the same, callers of either function who expect only one value won't be affected. Now when you test classify, you can see exactly what score went into the classification. SPAM> (classify "Make money fast") SPAM 0.863677101854273D0 SPAM> (classify "Want to go to the movies?") UNSURE 0.5D0 And now you can see what happens if you train the filter with some more ham text ...» | Код для вставки книги в блог HTML
phpBB
текст
|
|