Linguistics::EN::

Stemmer

module
Extended With
Linguistics::EN::Stemmer::SingletonMethods

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

Public Class Methods

anchor
stemmer()

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

# File lib/linguistics/en/stemmer.rb, line 54
def self::stemmer
        raise self.stemmer_error unless self.has_stemmer?
        @stemmer ||= Lingua::Stemmer.new
end

Public Instance Methods

anchor
stem()

Return the stem of the receiving word.

# File lib/linguistics/en/stemmer.rb, line 70
def stem
        return Linguistics::EN::Stemmer.stemmer.stem( self.obj.to_s )
end