diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-05-06 19:18:40 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-05-06 19:18:40 +0400 |
commit | 683b90f4c6c744557f7429ce6ff77c0f7d2175e1 (patch) | |
tree | 6e5f5cfdb0070cc7387d4045e955c6226d9f225d /src/classifiers | |
parent | 56586078f92c4cf71fad46e1f4888a49749a6313 (diff) | |
download | rspamd-683b90f4c6c744557f7429ce6ff77c0f7d2175e1.tar.gz rspamd-683b90f4c6c744557f7429ce6ff77c0f7d2175e1.zip |
* Major cleanup of cmake build system
* Add initial version of statshow utility for statfiles debugging
* Add debugging for statistics
* Remove unused utilities
Diffstat (limited to 'src/classifiers')
-rw-r--r-- | src/classifiers/bayes.c | 7 | ||||
-rw-r--r-- | src/classifiers/classifiers.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/classifiers/bayes.c b/src/classifiers/bayes.c index 9ef2544b0..b4f7826e5 100644 --- a/src/classifiers/bayes.c +++ b/src/classifiers/bayes.c @@ -131,6 +131,7 @@ bayes_classify_callback (gpointer key, gpointer value, gpointer data) if (cur->post_probability < G_MINDOUBLE * 100) { cur->post_probability = G_MINDOUBLE * 100; } + } renorm = 0; for (i = 0; i < cd->statfiles_num; i ++) { @@ -144,6 +145,10 @@ bayes_classify_callback (gpointer key, gpointer value, gpointer data) if (cur->post_probability < G_MINDOUBLE * 10) { cur->post_probability = G_MINDOUBLE * 100; } + if (cd->ctx->debug) { + msg_info ("token: %s, statfile: %s, probability: %.4f, post_probability: %.4f", + node->extra, cur->st->symbol, cur->value, cur->post_probability); + } } return FALSE; @@ -156,7 +161,7 @@ bayes_init (memory_pool_t *pool, struct classifier_config *cfg) ctx->pool = pool; ctx->cfg = cfg; - + ctx->debug = FALSE; return ctx; } diff --git a/src/classifiers/classifiers.h b/src/classifiers/classifiers.h index 0e6df173a..601db0205 100644 --- a/src/classifiers/classifiers.h +++ b/src/classifiers/classifiers.h @@ -15,6 +15,7 @@ struct worker_task; struct classifier_ctx { memory_pool_t *pool; GHashTable *results; + gboolean debug; struct classifier_config *cfg; }; |