3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 04:02:39 +01:00

Sanity check; don't want to match against identical words to the correction.

This commit is contained in:
Psychedelic Squid 2012-03-06 22:19:11 +00:00
parent 4e2d4017d0
commit 85bc47c152

View File

@ -13,7 +13,7 @@ var spelling = function(dbot) {
for(var i=0;i<candidates.length;i++) { for(var i=0;i<candidates.length;i++) {
var distance = String.prototype.distance(correction, candidates[i]); var distance = String.prototype.distance(correction, candidates[i]);
if(distance < winnerDistance) { if((distance < winnerDistance) && (distance > 0)) {
winner = candidates[i]; winner = candidates[i];
winnerDistance = distance; winnerDistance = distance;
} }