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:

  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.

PECL on Gentoo

If you try to install a PECL package without using Portage (thus using the PHP tool pecl), you might encounter an error like this snippet:

bender ~ # pecl install apc
downloading APC-3.0.8.tgz ...
autoconf: Undefined macros:
ERROR: `phpize' failed

The main problem lies with the use of automake v1.9.x. Since Gentoo comes with a bunch of different versions of the autotools, you can choose to use automake v1.8, which will result in a complete built.

bender ~ # WANT_AUTOMAKE="1.8" pecl install apc

As simple as it seems, it took me a while to fix it. Let me know if this helps.