]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve performance of language detector
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Apr 2018 15:24:28 +0000 (16:24 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 17 Apr 2018 15:24:28 +0000 (16:24 +0100)
src/libmime/lang_detection.c
src/libmime/message.c

index 0c82946ddce8ac2b88ccf81f3d1cc7876b897c53..0d9b40ec1eb836a6e3367b8c9f3394d588c07e02 100644 (file)
@@ -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));
index 844e4a5b46014a22d6e1a903b08085ffff7741b2..5681c3d001c9f8a43dcd6fc8e741e59f2209c65c 100644 (file)
@@ -1136,8 +1136,7 @@ rspamd_message_parse (struct rspamd_task *task)
                p2 = g_ptr_array_index (task->text_parts, 1);
 
                /* First of all check parent object */
-               if (p1->mime_part->parent_part &&
-                               p1->mime_part->parent_part == p2->mime_part->parent_part) {
+               if (p1->mime_part->parent_part) {
                        rspamd_ftok_t srch;
 
                        srch.begin = "alternative";