Porblem with custom analyzer

Hi,

I m trying to set French stop Words.
So i created a file called “FrenchStemmingAnalyzer.rb” and i put it in
/lib of my rails App.

class FrenchStemmingAnalyzer < Ferret::Analysis::Analyzer
include Ferret::Analysis
def initialize(stop_words = FULL_FRENCH_STOP_WORDS)
@stop_words = stop_words
end
def token_stream(field, str)
StemFilter.new(StopFilter.new(LowerCaseFilter.new(StandardTokenizer.new(str)),
@stop_words), ‘fr’)
end
end

Then i configured my Acts_as_ferret like that :
acts_as_ferret( { :fields => {
:video_id=> {},
:nom => {:boost => 200},
}, :remote => true, :ferret => {:analyzer =>
Ferret::Analysis::FrenchStemmingAnalyzer.new([])}})

But i ve got an error which say :
(Original exception: uninitialized constant
Ferret::Analysis::FrenchStemmingAnalyzer [NameError])

I don t know what went wrong…
is my custom analyzer synthax wrong ?
of do i have to put it somewhere else that in /lib of my Rails
application

Thanks for helping me with that,

Guillaume.

Guillaume Guillaume wrote:

Hi,

I m trying to set French stop Words.
So i created a file called “FrenchStemmingAnalyzer.rb” and i put it in
/lib of my rails App.

You might want to follow standard naming convention and rename the file
to: ‘french_stemming_analyzer.rb’ instead. Then drop a line like:

require ‘lib/french_stemming_analyzer’

inside config/environment.rb

-c-

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs