Module: Pedantic::Stems

Included in:
Pedantic
Defined in:
lib/pedantic/stems.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/pedantic/stems.rb', line 4

def self.included(base)
  base.processors :reduce_to_stems
end

Instance Method Details

#reduce_to_stems(string) ⇒ Object



8
9
10
11
12
# File 'lib/pedantic/stems.rb', line 8

def reduce_to_stems(string)
  string.split(/\W+/).collect { |word|
    word.stem
  }.join(' ')
end