From 32e21067f5eca848fb0f8b2dc776c8b80ce80061 Mon Sep 17 00:00:00 2001 From: Dafydd Francis Date: Sun, 1 Jan 2012 18:47:50 +0000 Subject: [PATCH 1/2] Changed 9999999 to Infinity --- modules/spelling.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/spelling.js b/modules/spelling.js index b376893..5db8da4 100644 --- a/modules/spelling.js +++ b/modules/spelling.js @@ -10,7 +10,7 @@ var spelling = function(dbot) { var correction = q[1]; var candidates = last[data.channel][data.user].split(' '); var winner = false; - var winnerDistance = 99999999; //urgh fix later + var winnerDistance = Infinity; //urgh fix later for(var i=0;i Date: Sun, 1 Jan 2012 20:35:43 +0000 Subject: [PATCH 2/2] cleaned up the spelling module --- modules/spelling.js | 78 +++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 42 deletions(-) diff --git a/modules/spelling.js b/modules/spelling.js index 5db8da4..cb5cc60 100644 --- a/modules/spelling.js +++ b/modules/spelling.js @@ -1,55 +1,49 @@ var spelling = function(dbot) { var dbot = dbot; var last = {}; + + var correct = function (data, correction, candidate, output_callback) { + var candidates = last[data.channel][candidate].split(' '); + var winner = false; + var winnerDistance = Infinity; //urgh fix later + + for(var i=0;i