diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-13 19:39:37 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-07-13 19:39:37 +0400 |
commit | b0ddff4f0d56a877305649a14b902b3f23140b4b (patch) | |
tree | 65a2066d13b480b062b20036280d18321fb91e94 /src/expressions.c | |
parent | 091e84951a2b032bb2930b300ffe43eaf01a304e (diff) | |
download | rspamd-b0ddff4f0d56a877305649a14b902b3f23140b4b.tar.gz rspamd-b0ddff4f0d56a877305649a14b902b3f23140b4b.zip |
* Add new algorithm based on diff algorithm to compare relatively short text parts
Diffstat (limited to 'src/expressions.c')
-rw-r--r-- | src/expressions.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/expressions.c b/src/expressions.c index c2af8288c..3dfd542a4 100644 --- a/src/expressions.c +++ b/src/expressions.c @@ -31,6 +31,7 @@ #include "expressions.h" #include "html.h" #include "lua/lua_common.h" +#include "diff.h" gboolean rspamd_compare_encoding (struct worker_task *task, GList * args, void *unused); gboolean rspamd_header_exists (struct worker_task *task, GList * args, void *unused); @@ -1083,7 +1084,12 @@ rspamd_parts_distance (struct worker_task * task, GList * args, void *unused) return FALSE; } if (!p1->is_empty && !p2->is_empty) { - diff = fuzzy_compare_parts (p1, p2); + if (p1->diff_str != NULL && p2->diff_str != NULL) { + diff = compare_diff_distance (p1->diff_str, p2->diff_str); + } + else { + diff = fuzzy_compare_parts (p1, p2); + } debug_task ("got likeliness between parts of %d%%, threshold is %d%%", diff, threshold); *pdiff = diff; memory_pool_set_variable (task->task_pool, "parts_distance", pdiff, NULL); |