[ACCEPTED]-how could I make a search match for similar words-search

Accepted answer
Score: 16

The Levenshtein Distance is what you are looking for.

For any 7 two strings, it calculates the minimum number 6 of insertions, mutations and deletions that 5 need to occur to changes one string to the 4 other.

If the distance is low then the two 3 words are similar.

You could also use the 2 Soundex algorithm to determine if two words sound 1 similar.

See also:
PHP levenshtein function
PHP soundex function

Score: 4

Well, there is the mother of all "related 12 word lists", called WordNet: http://wordnet.princeton.edu/

It's available 11 free of charge subject to a fairly generous 10 license. There is a PHP interface in the 9 "related projects" section.

The 8 advantage of this over using a word similarity 7 algorithm is that it even knows dissimilar 6 synonyms of words such as "paint" and 5 "colour". The downside is that 4 you either have to know the right synsets 3 (after all, one word can mean different 2 things) or you can get a pretty wild list 1 of synonyms.

More Related questions