Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] Regd - Stemming in SWISH API

From: Peter Karman <peter(at)>
Date: Thu Jan 29 2009 - 15:18:54 GMT
Bill Moseley wrote on 01/29/2009 08:58 AM:

> You don't enable it.  If the index was *created* with stemming then
> that's what is used in the API.
>     $fuzzy_word = $swish->Fuzzify( $indexname, $word );
> You have to specify the index so it knows which stemming algorithm to uses.
>     $fuzzy_word = $result->fuzzy_word( $word )
> That doesn't need to know the index because it's a method on the
> $result object and a result is tied to a given index.  That is, it
> implicitly knows what index to use.
> (Peter, those methods have changed, right?  Seems in the test.t file
> they return a Wordlist instead.  Sounds familiar. Is that because
> Snowball can sometimes return two stems?)

The methods have not changed, from what I can see. The Fuzzify() method
was added in SWISH::API 0.04 so that you could stem a word without
needing to search first. But it calls the same C lib code underneath as
$result->FuzzyWord does.

I believe it's Double Metaphone that can return multiple results and for
API consistency the fuzzy methods always return a WordList even though
it usually only has one item. But that decision predates me.

contains the swish_stem() test, which you can check for usage.

>> *Question 2:-*
>> $swish -> Fuzzify( $index, "lovely" );
>> when i print this, i'm getting output as "love"
>> But  i should get* love, lovely, loves, loving* as a output. Is it possible
>> with fuzzify?
> No, you should not get that.  That's not how the stemmer works.  The
> stemmer gives you the stem, not all variations of the word.

exactly. see for example.

Peter Karman  .  peter(at)  .

Users mailing list
Received on Thu Jan 29 10:10:24 2009