Class: Stopwords::Filter
- Inherits:
-
Object
- Object
- Stopwords::Filter
- Defined in:
- lib/stopwords/filter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#stopwords ⇒ Object
readonly
Returns the value of attribute stopwords.
Instance Method Summary collapse
- #filter(words) ⇒ Object
-
#initialize(stopwords) ⇒ Filter
constructor
A new instance of Filter.
- #stopword?(word) ⇒ Boolean
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
#stopwords ⇒ Object (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
15 16 17 |
# File 'lib/stopwords/filter.rb', line 15 def stopword? word stopwords.include? word end |