Ahhh, sorry, I misunderstood you.
I don't think it has to be that complicated.
I guess the magic comes in "if it finds a word which is only one letter switched ". Being a complete begineer at perl, this would be hard for me to suggest how.
But the logic would be:
That is a pretty basic mispell checker, but most of the time it is just a swapped letter isnt it?
I guess to take it one step further would be to look for a missing letter (on either end) or a superfulous letter.
Doesnt mysql or perl of a decent %like% function inbuilt? sorry for my ignorance here.
Or, lastely, find out if there is a GT module we could use, like the spell check in GT forum.
EDIT: It seems a lot of people opt for spell.vbs (MS Word's spell checker). But I think a simple function like above could at least get a lot of the common mistakes.
http://www.iuni.com/...tware/web/index.html
Links Plugins
I don't think it has to be that complicated.
- Hook (POST) on search query, check if zero results returned, and if so then run the correction sub.
- Correction sub... load in a file containing a list of commony mis spelled words, and compare the $query with each item in the list.... if it finds a word which is only one letter switched then produce the suggestion
I guess the magic comes in "if it finds a word which is only one letter switched ". Being a complete begineer at perl, this would be hard for me to suggest how.
But the logic would be:
- Load in one word at a time from the misspelledword.txt.
- Loop through each pair of letters in the word (1st and 2nd, then 2nd and 3rd etc) and swap these two letters to form a temporary word $match. If $match == $query, then we have a match.
That is a pretty basic mispell checker, but most of the time it is just a swapped letter isnt it?
I guess to take it one step further would be to look for a missing letter (on either end) or a superfulous letter.
Doesnt mysql or perl of a decent %like% function inbuilt? sorry for my ignorance here.
Or, lastely, find out if there is a GT module we could use, like the spell check in GT forum.
EDIT: It seems a lot of people opt for spell.vbs (MS Word's spell checker). But I think a simple function like above could at least get a lot of the common mistakes.
http://www.iuni.com/...tware/web/index.html
Links Plugins