diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-23 12:18:04 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-23 12:18:04 +0000 |
commit | 8f5509c65dc6907a7581518246a200236088423c (patch) | |
tree | 448c0233a83ee25855999033c22d78b2297b64f5 /src/libstat/classifiers | |
parent | 8969605e58c22b95ac4eb8783b6c4d045732810e (diff) | |
download | rspamd-8f5509c65dc6907a7581518246a200236088423c.tar.gz rspamd-8f5509c65dc6907a7581518246a200236088423c.zip |
Rework statistics runtime structures.
Diffstat (limited to 'src/libstat/classifiers')
-rw-r--r-- | src/libstat/classifiers/bayes.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c index 06c549292..54db73d9e 100644 --- a/src/libstat/classifiers/bayes.c +++ b/src/libstat/classifiers/bayes.c @@ -64,7 +64,7 @@ struct bayes_callback_data { static gboolean bayes_learn_callback (gpointer key, gpointer value, gpointer data) { - token_node_t *node = key; + rspamd_token_t *node = key; struct bayes_callback_data *cd = data; gint c; guint64 v; @@ -144,7 +144,7 @@ static gboolean bayes_classify_callback (gpointer key, gpointer value, gpointer data) { - token_node_t *node = key; + rspamd_token_t *node = key; struct bayes_callback_data *cd = data; guint i; struct bayes_statfile_data *cur; @@ -222,9 +222,7 @@ bayes_classify (struct classifier_ctx * ctx, (value = g_hash_table_lookup (ctx->cfg->opts, "min_tokens")) != NULL) { minnodes = strtol (value, NULL, 10); nodes = g_tree_nnodes (input); - if (nodes > FEATURE_WINDOW_SIZE) { - nodes = nodes / FEATURE_WINDOW_SIZE + FEATURE_WINDOW_SIZE; - } + if (nodes < minnodes) { return FALSE; } @@ -331,9 +329,7 @@ bayes_learn_spam (struct classifier_ctx * ctx, (value = g_hash_table_lookup (ctx->cfg->opts, "min_tokens")) != NULL) { minnodes = strtol (value, NULL, 10); nodes = g_tree_nnodes (input); - if (nodes > FEATURE_WINDOW_SIZE) { - nodes = nodes / FEATURE_WINDOW_SIZE + FEATURE_WINDOW_SIZE; - } + if (nodes < minnodes) { g_set_error (err, bayes_error_quark (), /* error domain */ |