[Snowball-discuss] php stemmer

Olly Betts olly at survex.com
Fri Oct 7 05:56:21 BST 2005


On Wed, Oct 05, 2005 at 05:57:49PM +0300, Eduards Cauna wrote:
> Xapian (http://www.xapian.org/) looks very promising but I would be happy 
> to have more detailed description of "Xapian-to-PHP" transformation. At 
> moment it looks scary... :) And PHP 5 compatibility would be nice.

I'm not sure I understand what you're asking.  Do you mean how Xapian's
C++ API is represented in PHP?  If so, you call the stemmer like this
in PHP:

 dl("xapian.so");
 $stem = new_Stem("english");
 echo Stem_stem_word($stem, "example");

Currently the C++ objects aren't wrapped as PHP objects because the code
in SWIG (we use SWIG to build the bindings) which tries to implement
this doesn't work.  However Kevin Ruland has recently started improving
SWIG's PHP support, so hopefully this will be fully working soon.  Then
it'll look something like:

 dl("xapian.so");
 $stem = new Stem("english");
 echo $stem->stem_word("example");

PHP5 support should be in the next release of Xapian.

Cheers,
    Olly



More information about the Snowball-discuss mailing list