diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-03-31 17:19:29 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-03-31 17:19:29 +0100 |
commit | 87820e7a7119207e0b8f5de334acb8fe4de1bd31 (patch) | |
tree | 8211fb899d21ea0a7fd62b6c13591d77f6e5ea3a /src/libstat/classifiers | |
parent | 87c2c304cd546f389e6b7b4fb349d08a76271ba6 (diff) | |
download | rspamd-87820e7a7119207e0b8f5de334acb8fe4de1bd31.tar.gz rspamd-87820e7a7119207e0b8f5de334acb8fe4de1bd31.zip |
[Minor] Some fixes for displaying tokens info
Diffstat (limited to 'src/libstat/classifiers')
-rw-r--r-- | src/libstat/classifiers/bayes.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c index 730581ced..aa6899d06 100644 --- a/src/libstat/classifiers/bayes.c +++ b/src/libstat/classifiers/bayes.c @@ -156,15 +156,30 @@ bayes_classify_token (struct rspamd_classifier *ctx, cl->ham_prob += log2 (bayes_ham_prob); cl->processed_tokens ++; - msg_debug_bayes ("token: weight: %f, total_count: %L, " - "spam_count: %L, ham_count: %L," - "spam_prob: %.3f, ham_prob: %.3f, " - "bayes_spam_prob: %.3f, bayes_ham_prob: %.3f, " - "current spam prob: %.3f, current ham prob: %.3f", - fw, total_count, spam_count, ham_count, - spam_prob, ham_prob, - bayes_spam_prob, bayes_ham_prob, - cl->spam_prob, cl->ham_prob); + if (tok->t1 && tok->t2) { + msg_debug_bayes ("token <%*s:%*s>: weight: %f, total_count: %L, " + "spam_count: %L, ham_count: %L," + "spam_prob: %.3f, ham_prob: %.3f, " + "bayes_spam_prob: %.3f, bayes_ham_prob: %.3f, " + "current spam prob: %.3f, current ham prob: %.3f", + (int) tok->t1->len, tok->t1->begin, + (int) tok->t2->len, tok->t2->begin, + fw, total_count, spam_count, ham_count, + spam_prob, ham_prob, + bayes_spam_prob, bayes_ham_prob, + cl->spam_prob, cl->ham_prob); + } + else { + msg_debug_bayes ("token <?:?>: weight: %f, total_count: %L, " + "spam_count: %L, ham_count: %L," + "spam_prob: %.3f, ham_prob: %.3f, " + "bayes_spam_prob: %.3f, bayes_ham_prob: %.3f, " + "current spam prob: %.3f, current ham prob: %.3f", + fw, total_count, spam_count, ham_count, + spam_prob, ham_prob, + bayes_spam_prob, bayes_ham_prob, + cl->spam_prob, cl->ham_prob); + } } } |