aboutsummaryrefslogtreecommitdiffstats
path: root/src/classifiers
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-01-22 18:42:50 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-01-22 18:42:50 +0300
commitf411d46ff24dc2bcc18fd2ea29f1f16612fc676d (patch)
treefed84311c81dce0ea529d62e49c99979866f412e /src/classifiers
parent480899d784fc491a81a88a7bd95e210d9121d69b (diff)
downloadrspamd-f411d46ff24dc2bcc18fd2ea29f1f16612fc676d.tar.gz
rspamd-f411d46ff24dc2bcc18fd2ea29f1f16612fc676d.zip
* Rework statfiles result processing
* Fix small bug in protocol implementation (\r -> \r\n)
Diffstat (limited to 'src/classifiers')
-rw-r--r--src/classifiers/classifiers.c2
-rw-r--r--src/classifiers/classifiers.h2
-rw-r--r--src/classifiers/winnow.c6
3 files changed, 9 insertions, 1 deletions
diff --git a/src/classifiers/classifiers.c b/src/classifiers/classifiers.c
index 5dab03122..aabdd7590 100644
--- a/src/classifiers/classifiers.c
+++ b/src/classifiers/classifiers.c
@@ -6,7 +6,7 @@
#include "classifiers.h"
struct classifier classifiers[] = {
- {"winnow", winnow_classify, winnow_learn },
+ {"winnow", winnow_classify, winnow_learn, winnow_add_result },
};
struct classifier*
diff --git a/src/classifiers/classifiers.h b/src/classifiers/classifiers.h
index eb5e5de4e..71a08c684 100644
--- a/src/classifiers/classifiers.h
+++ b/src/classifiers/classifiers.h
@@ -16,6 +16,7 @@ struct classifier {
char *name;
double (*classify_func)(statfile_pool_t *pool, char *statfile, GTree *input);
void (*learn_func)(statfile_pool_t *pool, char *statfile, GTree *input, int in_class);
+ double (*add_result_func)(double result, double new);
};
/* Get classifier structure by name or return NULL if this name is not found */
@@ -23,6 +24,7 @@ struct classifier* get_classifier (char *name);
/* Winnow algorithm */
double winnow_classify (statfile_pool_t *pool, char *statfile, GTree *input);
void winnow_learn (statfile_pool_t *pool, char *statfile, GTree *input, int in_class);
+double winnow_add_result (double result, double new);
/* Array of all defined classifiers */
extern struct classifier classifiers[];
diff --git a/src/classifiers/winnow.c b/src/classifiers/winnow.c
index 552f054b2..29aa94899 100644
--- a/src/classifiers/winnow.c
+++ b/src/classifiers/winnow.c
@@ -105,3 +105,9 @@ winnow_learn (statfile_pool_t *pool, char *statfile, GTree *input, int in_class)
statfile_pool_unlock_file (pool, statfile);
}
+
+double
+winnow_add_result (double result, double new)
+{
+ return result + new;
+}