List of utility methods to do String Levenshtein Distance
levenshtein()String.prototype.levenshtein = function() var s = this; var t = String(arguments[0] || ''); var cuthalf = Number(arguments.callee.maxComparedLength) || t.length; s = s.substr(0, cuthalf); t = t.substr(0, cuthalf); var m = s.length; var n = t.length; ... | |
levenshtein(str)String.prototype.levenshtein = function(str){ if (! str ){ return false; str = str.toLowerCase().replace(/[^a-z]/g, ""); var t = this.toLowerCase().replace(/[^a-z]/g, ""); var i; var j; var cost; ... | |
levenshteinDistance(c)String.prototype.levenshteinDistance = String.prototype.levenshteinDistance || function(c) { var s, l = (s = this.split("")).length, t = (c = c.split("")).length, i, j, m, n; if(!(l || t)) { ... |