まず、Bogofilter
On
Distribution
Media
(Linux, Unix) を見てください。
各ディストリビューション向けの情報が入手できます。
ディストリビューション | 配布先 |
Debian | 公式Mainセクション |
RHEL およびクローンOS | bogofilter RPM packages for Red Hat/Fedora |
Mandriva Linux | 公式Contribセクション |
SUSE Linux | OpenSUSE inst-sourceセクション |
# apt-cache show bogofilter
Package: bogofilter
Priority: optional
Section: mail
Installed-Size: 968
Maintainer: Clint Adams <schizo@debian.org>
Architecture: i386
Version: 0.94.4-1
Depends: libc6 (>= 2.3.2.ds1-4), libdb4.3, libgsl0 (>= 1.4)
Recommends: db4.3-util
Suggests: pax
Filename: pool/main/b/bogofilter/bogofilter_0.94.4-1_i386.deb
Size: 372034
MD5sum: 8df526263900146ecb41f3c0ba290da4
Description: a fast Bayesian spam filter
This package implements a fast Bayesian spam filter along the lines suggested
by Paul Graham in his article "A Plan For Spam".
.
This version substantially improves on Paul's proposal by doing smarter
lexical analysis. In particular, hostnames and IP addresses are retained
as recognition features rather than broken up. Various kinds of MTA
cruft such as dates and message-IDs are discarded so as not to bloat
the word lists.
# apt-get -s install bogofilter
パッケージリストを読みこんでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
libgsl0
提案パッケージ:
pax gsl-ref-psdoc gsl-doc-pdf gsl-ref-html
推奨パッケージ:
db4.3-util
以下のパッケージが新たにインストールされます:
bogofilter libgsl0
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 0 個。
Inst libgsl0 (1.6-2 Debian:3.1r1/stable)
Inst bogofilter (0.94.4-1 Debian:3.1r1/stable)
Conf libgsl0 (1.6-2 Debian:3.1r1/stable)
Conf bogofilter (0.94.4-1 Debian:3.1r1/stable)
# apt-get install bogofilter
パッケージリストを読みこんでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
libgsl0
提案パッケージ:
pax gsl-ref-psdoc gsl-doc-pdf gsl-ref-html
推奨パッケージ:
db4.3-util
以下のパッケージが新たにインストールされます:
bogofilter libgsl0
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 0 個。
1055kB のアーカイブを取得する必要があります。
展開後に追加で 2912kB のディスク容量が消費されます。
続行しますか? [Y/n] y
取得:1 http://ftp.jp.debian.org
stable/main libgsl0 1.6-2 [683kB]
取得:2 http://ftp.jp.debian.org
stable/main bogofilter 0.94.4-1 [372kB]
1055kB を 3s で取得しました (273kB/s)
未選択パッケージ libgsl0 を選択しています。
(データベースを読み込んでいます... 現在 114383 個のファイルとディレクトリがイン ストールされています。)
(.../libgsl0_1.6-2_i386.deb から) libgsl0 を展開しています...
未選択パッケージ bogofilter を選択しています。
(.../bogofilter_0.94.4-1_i386.deb から) bogofilter を展開しています...
libgsl0 (1.6-2) を設定しています ...
bogofilter (0.94.4-1) を設定しています ...
debian:/home/user# exit
exit
To classify messages as ham (non-spam) or spam, bogofilter needs to learn from your mail. To start with it is best to have collections (that are as large as possible) of messages you know for sure are ham or spam. (Errors here will cause problems later, so try hard;-). Warning: Only use your mail; using other collections (like a spam collection found on the web), might cause bogofilter to draw a wrong conclusion — after all you want it to understand your mail.
Once you have the spam and ham collections, you have basically four choices. In all cases it works better if your training base (the above collections) is bigger, rather than smaller. The smaller your training collection is, the higher the number of errors bogofilter will make in production. Let's assume your collection is two mbox files: ham.mbox and spam.mbox.
Method 1) Full training. Train bogofilter with all your messages. In our example:
bogofilter -s < spam.mbox
bogofilter -n < ham.mbox
Note: Bogofilter's contrib directory includes two scripts that
both
use a train-on-error technique. This technique scores each message and
adds to the database only those messages that were scored incorrectly
(messages scored as uncertain, ham scored as spam, or spam scored as
ham). The goal is to build a database of those words needed to
correctly classify messages. The resulting database is smaller than the
one build using full training.