Browse Source

Forgot in previous commit.

tags/0.5.3
Vsevolod Stakhov 11 years ago
parent
commit
9c867f8a27
2 changed files with 8 additions and 1 deletions
  1. 7
    0
      src/diff.h
  2. 1
    1
      src/expressions.c

+ 7
- 0
src/diff.h View File

@@ -64,4 +64,11 @@ gint rspamd_diff(const void *a, gint aoff, gint n, const void *b, gint boff, gin
*/
guint32 compare_diff_distance (f_str_t *s1, f_str_t *s2);

/*
* Calculate distance between two strings (in percentage) using diff algorithm. Strings are normalized before:
* all spaces are removed and all characters are lowercased.
* @return 100 in case of identical strings and 0 in case of totally different strings.
*/
guint32 compare_diff_distance_normalized (f_str_t *s1, f_str_t *s2);

#endif /* DIFF_H_ */

+ 1
- 1
src/expressions.c View File

@@ -1051,7 +1051,7 @@ rspamd_parts_distance (struct worker_task * task, GList * args, void *unused)
}
if (!p1->is_empty && !p2->is_empty) {
if (p1->diff_str != NULL && p2->diff_str != NULL) {
diff = compare_diff_distance (p1->diff_str, p2->diff_str);
diff = compare_diff_distance_normalized (p1->diff_str, p2->diff_str);
}
else {
diff = fuzzy_compare_parts (p1, p2);

Loading…
Cancel
Save