Module: Linguistics::EN::Stemmer

Extended by:
SingletonMethods
Defined in:
lib/linguistics/en/stemmer.rb

Overview

Ruby-Stemmer support for the English-language Linguistics module. It requires the Ruby-Stemmer gem to be installed; if it is not installed, calling the functions defined by this file will raise NotImplementedErrors.

# Test to be sure the Stemmer gem loaded okay.
Linguistics::EN.has_stemmer?
# => true

Defined Under Namespace

Modules: SingletonMethods

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SingletonMethods

has_stemmer?, stemmer_error

Class Method Details

.stemmerObject

The instance of the Lingua::Stemmer used for all Linguistics Stemmer functions.



54
55
56
57
# File 'lib/linguistics/en/stemmer.rb', line 54

def self::stemmer
	raise self.stemmer_error unless self.has_stemmer?
	@stemmer ||= Lingua::Stemmer.new
end

Instance Method Details

#stemObject

Return the stem of the receiving word.



70
71
72
# File 'lib/linguistics/en/stemmer.rb', line 70

def stem
	return Linguistics::EN::Stemmer.stemmer.stem( self.obj.to_s )
end