Class: Stopwords::Snowball::Filter

Inherits:
Filter
  • Object
show all
Defined in:
lib/stopwords/snowball/filter.rb

Instance Attribute Summary collapse

Attributes inherited from Filter

#stopwords

Instance Method Summary collapse

Methods inherited from Filter

#filter, #stopword?

Constructor Details

#initialize(locale, custom_list = []) ⇒ Filter

Returns a new instance of Filter.



7
8
9
10
11
12
13
# File 'lib/stopwords/snowball/filter.rb', line 7

def initialize locale, custom_list = []
  @locale = locale
  @locale_filename = "#{File.dirname(__FILE__)}/locales/#{locale}.csv"

  raise "Unknown locale" unless File.exists?(@locale_filename)
  super File.read(@locale_filename).split(",") + custom_list 
end

Instance Attribute Details

#localeObject (readonly)

Returns the value of attribute locale.



4
5
6
# File 'lib/stopwords/snowball/filter.rb', line 4

def locale
  @locale
end

#locale_filenameObject (readonly)

Returns the value of attribute locale_filename.



5
6
7
# File 'lib/stopwords/snowball/filter.rb', line 5

def locale_filename
  @locale_filename
end