List of utility methods to do String Score
score()String.prototype.score = function () { return this.replace(/ /g, '_'); }; | |
score(keyword)String.prototype.score = function(keyword) { if (string == keyword) { return 1.0; } if (keyword == "") { return 0; } var total_character_score = 0, keyword_length = keyword.length, string = this, string_length = string.length, compare_score = 0, final_score; ... | |
score(search)String.prototype.score = function(search) { if (search.length == 0 || this.length == 0) { return 0.0; } for (var i = search.length; i > 0; i--) { var subSearch = search.substring(0, i), index = this.search(new RegExp("\\b" + subSearch)), score = subSearch.length; if (index >= 0) { score += 1; ... |