summaryrefslogtreecommitdiffstats
path: root/src/libstat/classifiers
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-23 16:49:42 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-01-23 16:49:42 +0000
commitcaa189167ab79c8fb71de4c74ed4b97ceb619550 (patch)
tree3e27030f6178aa93fea7ff71d60752552c960141 /src/libstat/classifiers
parent82612bf153debaff5a11e5542caca454e921eeaf (diff)
downloadrspamd-caa189167ab79c8fb71de4c74ed4b97ceb619550.tar.gz
rspamd-caa189167ab79c8fb71de4c74ed4b97ceb619550.zip
Add initial processing routines.
Diffstat (limited to 'src/libstat/classifiers')
-rw-r--r--src/libstat/classifiers/bayes.c11
-rw-r--r--src/libstat/classifiers/classifiers.h10
2 files changed, 10 insertions, 11 deletions
diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c
index 54db73d9e..6e068b79d 100644
--- a/src/libstat/classifiers/bayes.c
+++ b/src/libstat/classifiers/bayes.c
@@ -26,11 +26,10 @@
* Bayesian classifier
*/
#include "classifiers.h"
-#include "tokenizers.h"
#include "main.h"
#include "filter.h"
#include "cfg_file.h"
-#include "lua/lua_common.h"
+#include "stat_internal.h"
#define LOCAL_PROB_DENOM 16.0
@@ -203,8 +202,7 @@ bayes_init (rspamd_mempool_t *pool, struct rspamd_classifier_config *cfg)
gboolean
bayes_classify (struct classifier_ctx * ctx,
GTree *input,
- struct rspamd_task *task,
- lua_State *L)
+ struct rspamd_task *task)
{
struct bayes_callback_data data;
gchar *value;
@@ -228,6 +226,8 @@ bayes_classify (struct classifier_ctx * ctx,
}
}
+ cur = ctx->cfg->statfiles;
+#if 0
cur = rspamd_lua_call_cls_pre_callbacks (ctx->cfg, task, FALSE, FALSE, L);
if (cur) {
rspamd_mempool_add_destructor (task->task_pool,
@@ -236,6 +236,8 @@ bayes_classify (struct classifier_ctx * ctx,
else {
cur = ctx->cfg->statfiles;
}
+#endif
+
data.statfiles_num = g_list_length (cur);
data.statfiles = g_new0 (struct bayes_statfile_data, data.statfiles_num);
@@ -312,7 +314,6 @@ bayes_learn_spam (struct classifier_ctx * ctx,
GTree *input,
struct rspamd_task *task,
gboolean is_spam,
- lua_State *L,
GError **err)
{
struct bayes_callback_data data;
diff --git a/src/libstat/classifiers/classifiers.h b/src/libstat/classifiers/classifiers.h
index 6a77f5aed..e2bf57f81 100644
--- a/src/libstat/classifiers/classifiers.h
+++ b/src/libstat/classifiers/classifiers.h
@@ -2,6 +2,7 @@
#define CLASSIFIERS_H
#include "config.h"
+#include "mem_pool.h"
/* Consider this value as 0 */
#define ALPHA 0.0001
@@ -22,10 +23,9 @@ struct rspamd_stat_classifier {
struct classifier_ctx * (*init_func)(rspamd_mempool_t *pool,
struct rspamd_classifier_config *cf);
gboolean (*classify_func)(struct classifier_ctx * ctx,
- GTree *input, struct rspamd_task *task,
- lua_State *L);
+ GTree *input, struct rspamd_task *task);
gboolean (*learn_spam_func)(struct classifier_ctx * ctx,
- GTree *input, struct rspamd_task *task, gboolean is_spam, lua_State *L,
+ GTree *input, struct rspamd_task *task, gboolean is_spam,
GError **err);
};
@@ -34,13 +34,11 @@ struct classifier_ctx * bayes_init (rspamd_mempool_t *pool,
struct rspamd_classifier_config *cf);
gboolean bayes_classify (struct classifier_ctx * ctx,
GTree *input,
- struct rspamd_task *task,
- lua_State *L);
+ struct rspamd_task *task);
gboolean bayes_learn_spam (struct classifier_ctx * ctx,
GTree *input,
struct rspamd_task *task,
gboolean is_spam,
- lua_State *L,
GError **err);
#endif