Module: Mongoid::Haystack::Stemming
Defined Under Namespace
Modules: Stopwords
Instance Method Summary collapse
- #stem(*args, &block) ⇒ Object (also: #for)
Instance Method Details
#stem(*args, &block) ⇒ Object Also known as: for
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mongoid-haystack/stemming.rb', line 6 def stem(*args, &block) words = args.join(' ').strip.split(/\s+/) list = [] words.each do |word| stem = word.stem.downcase next if Stopwords.stopword?(word) next if Stopwords.stopword?(stem) block ? block.call(stem) : list.push(stem) end block ? nil : list end |