]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Improve trigramms switch
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 13 Jan 2018 20:30:24 +0000 (20:30 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 13 Jan 2018 20:30:24 +0000 (20:30 +0000)
src/libmime/lang_detection.c

index ead12b8e8e6519bc455cea9831e529382cb5f315..6e3635a95acd4d9f771cfb0967bf8da7cea65868 100644 (file)
@@ -748,14 +748,14 @@ rspamd_language_detector_detect (struct rspamd_lang_detector *d,
                                        gdouble err;
                                        cand = (struct rspamd_lang_detector_res *) v;
                                        err = cand->prob - mean;
-                                       std += err * err;
+                                       std += fabs (err);
                                }
 
                                std /= g_hash_table_size (tcandidates);
                                g_hash_table_unref (candidates);
                                candidates = tcandidates;
 
-                               if (std < mean / 100) {
+                               if (std / fabs (mean) < 0.3) {
                                        /* Try trigramms */
                                        tcandidates = g_hash_table_new_full (rspamd_str_hash,
                                                        rspamd_str_equal,