Class: Lingo::Attendee::Stemmer

Inherits:
Lingo::Attendee show all
Defined in:
lib/lingo/attendee/stemmer.rb,
lib/lingo/attendee/stemmer/porter.rb

Defined Under Namespace

Modules: Porter

Constant Summary

Constant Summary

Constants inherited from Lingo::Attendee

DEFAULT_SKIP, Multi_worder, Multiworder, Noneword_filter, Nonewordfilter, Object_filter, Objectfilter, Text_reader, Text_writer, Textreader, Textwriter, Vector_filter, Vectorfilter, Word_searcher, Wordsearcher

Constants included from Language

Language::CHAR_PUNCT, Language::LA_SORTORDER, Language::TA_OTHER, Language::TA_PUNCTUATION, Language::TA_WORD, Language::WA_COMPOUND, Language::WA_IDENTIFIED, Language::WA_MULTIWORD, Language::WA_SEQUENCE, Language::WA_UNKMULPART, Language::WA_UNKNOWN, Language::WA_UNSET

Instance Attribute Summary

Attributes inherited from Lingo::Attendee

#lingo, #subscribers

Instance Method Summary collapse

Methods inherited from Lingo::Attendee

#command, #forward, #initialize

Constructor Details

This class inherits a constructor from Lingo::Attendee

Instance Method Details

#controlObject



40
41
# File 'lib/lingo/attendee/stemmer.rb', line 40

def control(*)
end

#initObject



33
34
35
36
37
38
# File 'lib/lingo/attendee/stemmer.rb', line 33

def init
  extend(Lingo.get_const(get_key('type', 'porter'), self.class))

  @wc  = get_key('wordclass', LA_STEM)
  @all = get_key('mode', '').downcase == 'all'
end

#process(obj) ⇒ Object



43
44
45
46
47
48
49
50
# File 'lib/lingo/attendee/stemmer.rb', line 43

def process(obj)
  if obj.is_a?(Word) && obj.unknown?
    stem = stem(Unicode.downcase(obj.form), @all)
    obj << Lexical.new(stem, @wc) if stem
  end

  forward(obj)
end