aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/lang_detection.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-17 16:24:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-17 16:24:28 +0100
commit1e8144bdbe638f0909ab72043ec6303b7e156760 (patch)
tree0c943352f36587a0b1bfada72b7d658abc76d340 /src/libmime/lang_detection.c
parentbdc18927e5e2c9d66fe6b555308585433865a913 (diff)
downloadrspamd-1e8144bdbe638f0909ab72043ec6303b7e156760.tar.gz
rspamd-1e8144bdbe638f0909ab72043ec6303b7e156760.zip
[Minor] Improve performance of language detector
Diffstat (limited to 'src/libmime/lang_detection.c')
-rw-r--r--src/libmime/lang_detection.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libmime/lang_detection.c b/src/libmime/lang_detection.c
index 0c82946dd..0d9b40ec1 100644
--- a/src/libmime/lang_detection.c
+++ b/src/libmime/lang_detection.c
@@ -891,6 +891,10 @@ rspamd_language_detector_process_ngramm_full (struct rspamd_task *task,
PTR_ARRAY_FOREACH (chain->languages, i, elt) {
cand = g_hash_table_lookup (candidates, elt->elt->name);
prob = elt->prob;
+
+ if (prob < chain->mean) {
+ continue;
+ }
#ifdef NGRAMMS_DEBUG
msg_err ("gramm: %s, lang: %s, prob: %.3f", chain->utf,
elt->elt->name, log2 (elt->prob));