anrake wrote:
> Hi, if I use this stemming analyzer, where do I put it ? /lib/ and 
> require it in each model?
> 
> -Anrake
> 
> David Balmain wrote:
>> On 9/6/06, Alastair Moore <[EMAIL PROTECTED]> wrote:
Can someone give



Can someone give me an idiots guide as to how to implement this custom 
stemming analyser. I do not know where to start.

Thanks for your patience.

>>> Alastair
>> The default analyzer doesn't perform any stemming. You need to create
>> your own analyzer with a stemmer. Something like this;
>> 
>>     require 'rubygems'
>>     require 'ferret'
>> 
>>     module Ferret::Analysis
>>       class MyAnalyzer
>>         def token_stream(field, text)
>>           StemFilter.new(StandardTokenizer.new(text))
>>         end
>>       end
>>     end
>> 
>>     index = Ferret::I.new(:analyzer => Ferret::Analysis::MyAnalyzer.new)
>> 
>>     index << "test"
>>     index << "tests debate debater debating the for,"
>>     puts index.search("test").total_hits
>> 
>> Hope that helps,
>> Dave


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
Ferret-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to