Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [yogi] [Development] Spell Correction on Query

Quote Reply
Re: [yogi] [Development] Spell Correction on Query In reply to
Ahhh, sorry, I misunderstood you.Blush

I don't think it has to be that complicated.
  1. Hook (POST) on search query, check if zero results returned, and if so then run the correction sub.
  2. 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

Last edited by:

Ian: May 31, 2002, 2:07 PM
Subject Author Views Date
Thread [Development] Spell Correction on Query Ian 10621 May 30, 2002, 7:20 PM
Thread Re: [Ian] [Development] Spell Correction on Query
Andy 10443 May 31, 2002, 3:23 AM
Thread Re: [Andy] [Development] Spell Correction on Query
yogi 10478 May 31, 2002, 4:49 AM
Thread Re: [yogi] [Development] Spell Correction on Query
Ian 10414 May 31, 2002, 9:02 AM
Thread Re: [Ian] [Development] Spell Correction on Query
yogi 10430 May 31, 2002, 1:21 PM
Thread Re: [yogi] [Development] Spell Correction on Query
Ian 10470 May 31, 2002, 1:28 PM
Thread Re: [Ian] [Development] Spell Correction on Query
yogi 10423 May 31, 2002, 1:31 PM
Thread Re: [yogi] [Development] Spell Correction on Query
Ian 10398 May 31, 2002, 1:44 PM
Thread Re: [Ian] [Development] Spell Correction on Query
SeanP 10408 May 31, 2002, 2:30 PM
Post Re: [SeanP] [Development] Spell Correction on Query
Ian 10380 May 31, 2002, 2:36 PM
Post Re: [yogi] [Development] Spell Correction on Query
Ian 10418 May 31, 2002, 4:26 PM
Post Re: [yogi] [Development] Spell Correction on Query
Ian 10350 May 31, 2002, 5:36 PM
Post Re: [yogi] [Development] Spell Correction on Query
el noe 9636 Aug 13, 2009, 4:24 PM
Thread Re: [Ian] [Development] Spell Correction on Query
KevM 10037 Jul 21, 2006, 3:20 PM
Thread Re: [KevM] [Development] Spell Correction on Query
afinlr 10010 Jul 25, 2006, 11:06 AM
Post Re: [afinlr] [Development] Spell Correction on Query
KevM 9986 Jul 25, 2006, 11:29 AM