From: yamaoka Date: Wed, 21 Jan 2004 02:02:22 +0000 (+0000) Subject: Synch to No Gnus 200401210200. X-Git-Tag: t-gnus-6_17_4-quimby-~1118 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe6de291e5a194a3894e1b59ece95c8d0a7fa4b6;p=elisp%2Fgnus.git- Synch to No Gnus 200401210200. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 65a8a5a..3dba533 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2004-01-21 Jesper Harder + + * spam-stat.el (spam-stat-test-directory): New optional argument + displays a list of files detected. Suggested by Andrew Cohen + . + 2004-01-20 Teodor Zlatanov * spam.el (gnus-summary-mode-map): make spam-generic-score the @@ -36,7 +42,7 @@ 2004-01-20 Jesper Harder - * spam-stat.el (spam-stat-to-hash-table): Use :size argument in + * spam-stat.el (spam-stat-to-hash-table): Use :size keyword in make-hash-table. 2004-01-19 Katsumi Yamaoka diff --git a/lisp/spam-stat.el b/lisp/spam-stat.el index 8464c2b..97aa160 100644 --- a/lisp/spam-stat.el +++ b/lisp/spam-stat.el @@ -504,13 +504,19 @@ check the variable `spam-stat-score-data'." (interactive) (hash-table-count spam-stat)) -(defun spam-stat-test-directory (dir) +(defun spam-stat-test-directory (dir &optional verbose) "Test all the regular files in directory DIR for spam. If the result is 1.0, then all files are considered spam. If the result is 0.0, non of the files is considered spam. -You can use this to determine error rates." - (interactive "D") +You can use this to determine error rates. + +If VERBOSE is non-nil display names of files detected as spam or +non-spam in a temporary buffer. If it is the symbol `ham', +display non-spam files; otherwise display spam files." + (interactive "DDirectory: ") (let* ((files (directory-files dir t "^[^.]")) + display-files + buffer-score (total (length files)) (score 0.0); float (max (/ total 100.0)); float @@ -521,12 +527,22 @@ You can use this to determine error rates." (file-regular-p f) (> (nth 7 (file-attributes f)) 0)) (setq count (1+ count)) - (message "Reading %.2f%%, score %.2f%%" - (/ count max) (/ score count)) + (message "Reading %.2f%%, score %.2f" + (/ count max) (/ score count)) (insert-file-contents f) - (when (> (spam-stat-score-buffer) 0.9) + (setq buffer-score (spam-stat-score-buffer)) + (when (> buffer-score 0.9) (setq score (1+ score))) + (when verbose + (if (> buffer-score 0.9) + (unless (eq verbose 'ham) (push f display-files)) + (when (eq verbose 'ham) (push f display-files)))) (erase-buffer)))) + (when display-files + (with-output-to-temp-buffer "*spam-stat results*" + (dolist (file display-files) + (princ file) + (terpri)))) (message "Final score: %d / %d = %f" score total (/ score total)))) ;; Shrinking the dictionary