diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-15 12:41:22 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-15 12:41:22 +0000 |
commit | d2f82b9a72ce34fdcb757e08072bcc2bef9cac28 (patch) | |
tree | 9d0fda6f16a6553dec6537c1fce450088d8e6273 /src | |
parent | 19a76b29c6bab95be01dedd34d2b89c38ab45959 (diff) | |
download | rspamd-d2f82b9a72ce34fdcb757e08072bcc2bef9cac28.tar.gz rspamd-d2f82b9a72ce34fdcb757e08072bcc2bef9cac28.zip |
[Minor] Add new config options to classifiers
Diffstat (limited to 'src')
-rw-r--r-- | src/libserver/cfg_file.h | 2 | ||||
-rw-r--r-- | src/libserver/cfg_rcl.c | 12 | ||||
-rw-r--r-- | src/libserver/cfg_utils.c | 3 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h index f1d9eb939..c507bf3a9 100644 --- a/src/libserver/cfg_file.h +++ b/src/libserver/cfg_file.h @@ -174,6 +174,8 @@ struct rspamd_classifier_config { gchar *name; /**< unique name of classifier */ guint32 min_tokens; /**< minimal number of tokens to process classifier */ guint32 max_tokens; /**< maximum number of tokens */ + guint min_token_hits; /**< minimum number of hits for a token to be considered */ + gdouble min_prob_strength; /**< use only tokens with probability in [0.5 - MPS, 0.5 + MPS] */ guint min_learns; /**< minimum number of learns for each statfile */ guint flags; }; diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index e44051c9d..3df4ce05d 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -2148,6 +2148,18 @@ rspamd_rcl_config_init (struct rspamd_config *cfg, GHashTable *skip_sections) RSPAMD_CL_FLAG_INT_32, "Minimum count of tokens (words) to be considered for statistics"); rspamd_rcl_add_default_handler (sub, + "min_token_hits", + rspamd_rcl_parse_struct_integer, + G_STRUCT_OFFSET (struct rspamd_classifier_config, min_token_hits), + RSPAMD_CL_FLAG_UINT, + "Minimum number of hits for a token to be considered"); + rspamd_rcl_add_default_handler (sub, + "min_prob_strength", + rspamd_rcl_parse_struct_double, + G_STRUCT_OFFSET (struct rspamd_classifier_config, min_token_hits), + 0, + "Use only tokens with probability in [0.5 - MPS, 0.5 + MPS]"); + rspamd_rcl_add_default_handler (sub, "max_tokens", rspamd_rcl_parse_struct_integer, G_STRUCT_OFFSET (struct rspamd_classifier_config, max_tokens), diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 198e55530..45f289e89 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -971,7 +971,10 @@ rspamd_config_new_classifier (struct rspamd_config *cfg, c = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct rspamd_classifier_config)); + c->min_prob_strength = 0.343; + c->min_token_hits = 2; } + if (c->labels == NULL) { c->labels = g_hash_table_new_full (rspamd_str_hash, rspamd_str_equal, |