You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by "Shreyansh Shrivastava." <sh...@nitk.edu.in> on 2019/06/17 19:10:08 UTC

Check_bayes sub in Bayes.pm

I am trying to develop a plugin for a SVM classifier. I intend to make it
similar to the Bayes plugin but I couldn't figure out the entry point for
the check_bayes() subroutine. Can anyone help me with this?

Re: Check_bayes sub in Bayes.pm

Posted by Bill Cole <sa...@billmail.scconsult.com>.
On 17 Jun 2019, at 16:41, Shreyansh Shrivastava. wrote:

> Check_bayes() is declared in Bayes.pm. An object of Bayes.pm is made 
> in
> init() sub of spamassassin.pm but check_bayes() isn't called there.
>
> The 23_bayes.cf file has various configuration for check_bayes() 
> having
> different min,max defined. Also check_bayes() is passed to
> register_eval_rule() of Conf.pm. I am not able to connect these dots 
> to get
> the entry point.

When the Mail::SpamAssassin object is initialized, it parses all of the 
.cf files and constructs a subroutine from each "rule" line loaded. See 
Mail::SpamAssassin::Conf::Parser, particularly add_test() and 
finish_parsing().


The rule lines in 23_bayes.cf like this:

body BAYES_00		eval:check_bayes('0.00', '0.01')
body BAYES_05		eval:check_bayes('0.01', '0.05')

are each translated into a test subroutine that calls check_bayes(). The 
pile of subroutines that is constructed from rules is called when 
Mail::SpamAssassin->check() is called, by way of 
Mail::SpamAssassin::PerMsgStatus->check() and 
Mail::SpamAssassin::PerMsgStatus->check_timed().

Does that help?


-- 
Bill Cole
bill@scconsult.com or billcole@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire

Re: Check_bayes sub in Bayes.pm

Posted by "Shreyansh Shrivastava." <sh...@nitk.edu.in>.
Check_bayes() is declared in Bayes.pm. An object of Bayes.pm is made in
init() sub of spamassassin.pm but check_bayes() isn't called there.

The 23_bayes.cf file has various configuration for check_bayes() having
different min,max defined. Also check_bayes() is passed to
register_eval_rule() of Conf.pm. I am not able to connect these dots to get
the entry point.

On Tue, 18 Jun 2019, 00:40 Shreyansh Shrivastava., <
shreyansh.171co244@nitk.edu.in> wrote:

> I am trying to develop a plugin for a SVM classifier. I intend to make it
> similar to the Bayes plugin but I couldn't figure out the entry point for
> the check_bayes() subroutine. Can anyone help me with this?
>