Class: Word::Tagger

Inherits:
Tagger::WordTagger
  • Object
show all
Defined in:
lib/word/tagger.rb

Instance Method Summary collapse

Constructor Details

#initialize(tags, options = {}) ⇒ Tagger

Returns a new instance of Tagger.



6
7
8
9
10
11
12
13
# File 'lib/word/tagger.rb', line 6

def initialize( tags, options = {} )
  if tags.is_a?(String) and File.exist?(tags)
    load_tags( RbTagger.tags_from_file( tags ) )
  else
    load_tags( tags )
  end
  set_words( options[:words] || 2 )
end

Instance Method Details

#execute(text) ⇒ Object



15
16
17
18
# File 'lib/word/tagger.rb', line 15

def execute( text )
  # strip non alpha characters
  super( text.gsub(/[^\w]/,' ') )
end