Skip to content

stem-1.4.3 for PHP released!

As of today, you can download a new release of the PHP stem interface to the Snowball API on PECL. While this extension has been written by Jay Smith, I have since joined him to help on further development.

If you do not know what a stemmer is, the article on Wikipedia is self explanatory. Basically, it allows a computer program to find a common root for different forms of the same word. While Dr. Porter did a great job creating stemmers for different languages and the Snowball API, it was not available directly from a PHP script.

Now that this limitation is gone, you might want to try using the stemmer to create an intelligent search engine for your website. If you want to give it a try, issue the following command on your favorite UNIX based machine: pecl install stem. Once the installation has completed, you might want to modify your php.ini to load the extension and then try the following example:

<?php
  print stem_english('cleaner') ."\n";
  print stem_french('épouses') ."\n";
?>

This would output clean and épous respectively. In some cases, the word outputed by the stemmer will not exist in a dictionary, but this is rarely a problem. In fact, you should only stem words to use them as keywords in some kind of database.