# Porblem with custom analyzer

**URL:** <https://www.ruby-forum.com/t/porblem-with-custom-analyzer/136289>\
**Category:** Ferret\
**Created:** [April 30, 2008, 1:50pm UTC](https://www.ruby-forum.com/t/porblem-with-custom-analyzer/136289 "2008-04-30T13:50:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![djtal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9bcb4/32.png) [@djtal](https://www.ruby-forum.com/u/djtal)\
**Post date:** [April 30, 2008, 1:50pm UTC](https://www.ruby-forum.com/t/porblem-with-custom-analyzer/136289/1 "2008-04-30T13:50:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![djtal](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9bcb4/32.png) [@djtal](https://www.ruby-forum.com/u/djtal)\
**Post date:** [May 6, 2008, 7:50am UTC](https://www.ruby-forum.com/t/porblem-with-custom-analyzer/136289/2 "2008-05-06T07:50:40Z")

</div>

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-
