Class: SloveneStemmer::Stem

Inherits:
Struct
  • Object
show all
Defined in:
lib/slovene_stemmer/stem.rb

Constant Summary collapse

SYMBOLS =
%w[, . ! : ; - _ ( ) ?].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stemObject

Returns the value of attribute stem

Returns:

  • (Object)

    the current value of stem



2
3
4
# File 'lib/slovene_stemmer/stem.rb', line 2

def stem
  @stem
end

Instance Method Details

#ends_with?(ending_candidates) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/slovene_stemmer/stem.rb', line 5

def ends_with?(ending_candidates)
  ending_candidates.any? { |ending| stem.downcase.end_with?(ending) }
end

#lengthObject



19
20
21
# File 'lib/slovene_stemmer/stem.rb', line 19

def length
  stem.length
end

#remove_last_char!Object



9
10
11
# File 'lib/slovene_stemmer/stem.rb', line 9

def remove_last_char!
  self.stem = stem[0...-1]
end

#remove_symbols!Object



13
14
15
16
17
# File 'lib/slovene_stemmer/stem.rb', line 13

def remove_symbols!
  SYMBOLS.each do |symbol|
    stem.gsub!(symbol, ' ')
  end
end

#to_sObject



23
24
25
# File 'lib/slovene_stemmer/stem.rb', line 23

def to_s
  stem
end