Reference Manuals

Bogofilter

Bogofilter — An interface to the bogofilter spamfilter

Bogofilter is part of the SpamFilter package.

Synopsis

class Bogofilter {
        public         bool                $add_bogosity_header
        public         bool                $auto_register
        public         string              $bin
        public         string              $database_path
        private        string              $error
        public         float               $ham_cutoff
        public         float               $min_dev
        public         float               $ns_esf
        public         bool                $parse_headers
        public         float               $robs
        public         float               $robx
        public         float               $spam_cutoff
        public         float               $sp_esf

        private        string              build_command             ( mixed $options );
        public         void                error                     ( void );
        public         int                 filter                    ( string $message,
                                                                       mixed &$score );
        public         float               get_score                 ( mixed $message );
        public         bool                register                  ( string $message,
                                                                       int $class );
        private        float               run                       ( string $message,
                                                                       string $options );
        public         bool                unregister                ( string $message,
                                                                       int $class );
}

Object Hierarchy

Bogofilter

Description

An interface to the bogofilter spamfilter

Attribute Details

$add_bogosity_header

public         bool           $add_bogosity_header

Sets the X-Bogosity header when filtering e-mails

Default value: empty string


$auto_register

public         bool           $auto_register

Register the message's text after classifying it as spam or non-spam. A spam message will be registered on the spamlist and a non-spam message on the goodlist. If the classification is "unsure", the message will not be registered. Caution is urged in the use of this capability, as any classification errors bogofilter may make will be preserved and will accumulate. Note this option cause the database to be opened for write access, which can entail massive slowdowns through lock contention and synchronous I/O operations.

Default value: empty string


$bin

public         string         $bin

The bogofilter command. This can contain a full path

Default value: empty string


$database_path

public         string         $database_path

Path to a directory that holds the bogofilter database

Default value: empty string


$error

private        string         $error

The output to stderr of the last bogofilter run

Default value: empty string


$ham_cutoff

public         float          $ham_cutoff

Any text with a bogosity below this cutoff are marked as ham. Anything above is either spam or unsure

Default value: empty string


$min_dev

public         float          $min_dev

Minumum Deviation. Please refer to the bogofilter man page for more information

Default value: empty string


$ns_esf

public         float          $ns_esf

Effective Size Factor values. Please refer to the bogofilter man page for more information

Default value: empty string


$parse_headers

public         bool           $parse_headers

Whether the input is e-mail messages containing e-mail headers or simple text (such as blog comments)

Default value: empty string


$robs

public         float          $robs

Robinson Constants. Please refer to the bogofilter man page for more information

Default value: empty string


$robx

public         float          $robx

Robinson Constants. Please refer to the bogofilter man page for more information

Default value: empty string


$spam_cutoff

public         float          $spam_cutoff

Any text with a bogosity above this cutoff are marked as spam. Anything below is either ham or unsure

Default value: empty string


$sp_esf

public         float          $sp_esf

Effective Size Factor values. Please refer to the bogofilter man page for more information

Default value: empty string

Method Details

build_command()

private        string         build_command             ( mixed $options );

Build the command to execute.

$options
The extra options to pass to bogofilter. This will usually be one of sSnN to (un)register a message.

error()

public         void           error                     ( void );

Get the errors from the last bogofilter run


filter()

public         int            filter                    ( string $message,
                                                          mixed &$score );

Run a message through bogofilter

$message
The message you want to filter
&$score
This will be assigned the spam score of the message

get_score()

public         float          get_score                 ( mixed $message );

Get the spam score of a message

$message
The message to filter

register()

public         bool           register                  ( string $message,
                                                          int $class );

Register a message as spam or ham

$message
The message to register
$class
BG_SPAM or BG_HAM

run()

private        float          run                       ( string $message,
                                                          string $options );

Run bogosity on the message with the extra options given

$message
The message to filter
$options
Extra options. Usually one of sSnN

unregister()

public         bool           unregister                ( string $message,
                                                          int $class );

Undo a previous registration of a message as spam or ham

$message
The message to unregister
$class
BG_SPAM or BG_HAM