Subversion Repositories Applications.dictionnaire

Rev

Rev 9 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9 Rev 11
Line 13... Line 13...
13
	});
13
	});
14
	assoc_mot_clef[mot] = proche;
14
	assoc_mot_clef[mot] = proche;
15
	return proche;
15
	return proche;
16
}
16
}
Line 17... Line -...
17
 
-
 
18
// http://stackoverflow.com/questions/1960473/unique-values-in-an-array
-
 
19
function getUnique(tableau) {
-
 
20
	var u = {}, a = [];
-
 
21
	for(var i = 0, l = tableau.length; i < l; ++i){
-
 
22
		if(u.hasOwnProperty(tableau[i])) {
-
 
23
			continue;
-
 
24
		}
-
 
25
		a.push(tableau[i]);
-
 
26
		u[tableau[i]] = 1;
-
 
27
	}
-
 
28
	return a;
-
 
29
}
-
 
30
 
-
 
31
// http://stackoverflow.com/questions/281264/remove-empty-elements-from-an-array-in-javascript
-
 
32
function clean(tableau, deleteValue) {
-
 
33
	for (var i = 0; i < tableau.length; i++) {
-
 
34
		if (tableau[i] == deleteValue) {
-
 
35
			tableau.splice(i, 1);
-
 
36
			i--;
-
 
37
		}
-
 
38
	}
-
 
39
	return tableau;
-
 
40
}
-
 
41
 
-
 
42
function trim(myString) {
-
 
43
	return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
-
 
44
}
-
 
45
 
17
 
46
function levenshtein (s1, s2) {
18
function levenshtein (s1, s2) {
47
	// http://kevin.vanzonneveld.net
19
	// http://kevin.vanzonneveld.net
48
	// +            original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
20
	// +            original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
49
	// +            bugfixed by: Onno Marsman
21
	// +            bugfixed by: Onno Marsman
Line 111... Line 83...
111
		v0 = v1;
83
		v0 = v1;
112
		v1 = v_tmp;
84
		v1 = v_tmp;
113
	}
85
	}
114
	return v0[s1_len];
86
	return v0[s1_len];
115
}
87
}
116
 
-