From 444817f145bc60f20701b8e92529bfb38aa0f50e Mon Sep 17 00:00:00 2001 From: Dafydd Francis Date: Sun, 1 Jan 2012 20:35:43 +0000 Subject: [PATCH] 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