Class: Stopwords::Filter

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

Direct Known Subclasses

Snowball::Filter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stopwords) ⇒ Filter

Returns a new instance of Filter.



7
8
9
# File 'lib/stopwords/filter.rb', line 7

def initialize stopwords
  @stopwords = stopwords
end

Instance Attribute Details

#stopwordsObject (readonly)

Returns the value of attribute stopwords.



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

def stopwords
  @stopwords
end

Instance Method Details

#filter(words) ⇒ Object



11
12
13
# File 'lib/stopwords/filter.rb', line 11

def filter words
  words - @stopwords
end

#stopword?(word) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/stopwords/filter.rb', line 15

def stopword? word
  stopwords.include? word
end