• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

More spell check questions

robphelan

Diamond Member
thanks for the help in the previous thread. I'm using the Metaphone algorithm, and my spell check app is coming along pretty well.

I have another problem.

Let's say I misspell impractical as impratical.
The metaphone codes are:
impractical - IMPRKTKL
impratical - IMPRTKL

What I had been doing was finding the metaphone code for the misspelled word and searching for matches. If none found, I would take the first x - n characters and try to find a match.

So I would look for:
IMPRTKL* then
IMPRTK* then
IMPRT* etc... until I found some matches.

The problem is that the misspelling is in the middle of the word and it is a consonant - I would have to go all the way down to IMPR* which gives me a list of hundreds and hundreds of matches.

Other mid-word misspellings aren't a big issue because they don't change the sound of the word.

Someone mentioned in the other thread a mehtod of calculating the shortest path of changes from incorrect to correct word.

how does that work?

thanks for your help!
 
This site has everything you need to know about understanding and implementing the Levenshtein Distance algorithm. It's fairly straightforward once you understand the logic behind it.
 
thanks a lot for that link!

So it looks like I need to have my misspelled word (impratical) and a list of up to dozens of suggestions.

Calculate the LD and display the ones with the lowest results.

Sound about right?

My issue would be how to correctly return the suggestions using the metaphone algorithm..

I guess I could take the first few letters of my metaphone code and retrieve suggestions. Then take the last few letters of my metaphone code and retrieve suggestions for those.

From this result set, I guess I would run the LD algorithm and come up with the shortest distance - return the lowest 5 - 7 results to user?
 
Last edited:
Back
Top