Class: MiniSearch::StopWordsFilter
- Inherits:
-
Object
- Object
- MiniSearch::StopWordsFilter
- Defined in:
- lib/mini_search/stop_words_filter.rb
Instance Method Summary collapse
- #execute(tokens) ⇒ Object
-
#initialize(stop_words) ⇒ StopWordsFilter
constructor
A new instance of StopWordsFilter.
Constructor Details
#initialize(stop_words) ⇒ StopWordsFilter
Returns a new instance of StopWordsFilter.
5 6 7 |
# File 'lib/mini_search/stop_words_filter.rb', line 5 def initialize(stop_words) @stop_words = stop_words end |
Instance Method Details
#execute(tokens) ⇒ Object
9 10 11 |
# File 'lib/mini_search/stop_words_filter.rb', line 9 def execute(tokens) tokens.reject { |token| @stop_words.include?(token) } end |