PHPDeveloper.orghttp://www.phpdeveloper.org
Up-to-the Minute PHP News, views and communityen-usTue, 03 Mar 2015 16:51:03 -060030http://www.phpdeveloper.org/news/12423http://www.phpdeveloper.org/news/12423
In a recent post to his blog Sameer looks at implementing a Stemming algorithm to search an array of words. It uses this library (as written by Richard Heyes).

A stemming algorithm lets you reduce each English input word to its basic root or stem (e.g. 'walking' to 'walk') so that variations on a word ('walks', 'walked', 'walking') are considered equivalent when searching. This stems can than be used in a search query rather than the original words, which generally (but not always) results in more relevant search results.

His code example uses the library to search for two different types of strings - a single word and a phrase (with stop words removed). The Stem() method is called on the word and the results are looped through to remove all matching the values in the stop words array.