Skip to main content.
home | support | download

Back to List Archive

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

From: Bill Moseley <moseley(at)>
Date: Thu Jan 29 2009 - 14:58:52 GMT
Please send mail only to the swish-e list (not multiple copies to
different addresses -- and thanks, but I don't need Gmail invites.)

On Thu, Jan 29, 2009 at 12:43:16PM +0530, saravanan K wrote:
> Hi,
> *Question 1:-*
> Stemming is supported with the SWISH FuzzyMode option.
> If FuzzyMode was used in the SWISH::API object passed in new(), then
> Queries() will take the stemmed version of the word into account.
> How can i enable/use fuzzymode option in SWISH::API new() method.

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?)

> Is it automatically stems, If FuzzyMode was used in the SWISH::API object
> passed in new(), then Queries().

Yes, queries are stemmed automatically, if that's the question.

> Any examples?

See the SWISH::API t/test.t file

> *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.

> I should get both stem and destem of the input.
> In which method i'll get the exact results("love", "lovely", "loves",
> "loving")

If you want that you will have to use other means.  Maybe feed a
dictionary into the stemmer then index all words by their stem.

Bill Moseley
Sent from my iMutt

Users mailing list
Received on Thu Jan 29 09:50:35 2009