mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 12:12:35 +01:00
Sanity check; don't want to match against identical words to the correction.
This commit is contained in:
parent
4e2d4017d0
commit
85bc47c152
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user