Class: SloveneStemmer::Stem
- Inherits:
-
Struct
- Object
- Struct
- SloveneStemmer::Stem
- Defined in:
- lib/slovene_stemmer/stem.rb
Constant Summary collapse
- SYMBOLS =
%w[, . ! : ; - _ ( ) ?].freeze
Instance Attribute Summary collapse
-
#stem ⇒ Object
Returns the value of attribute stem.
Instance Method Summary collapse
- #ends_with?(ending_candidates) ⇒ Boolean
- #length ⇒ Object
- #remove_last_char! ⇒ Object
- #remove_symbols! ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#stem ⇒ Object
Returns the value of attribute stem
2 3 4 |
# File 'lib/slovene_stemmer/stem.rb', line 2 def stem @stem end |
Instance Method Details
#ends_with?(ending_candidates) ⇒ 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 |
#length ⇒ Object
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_s ⇒ Object
23 24 25 |
# File 'lib/slovene_stemmer/stem.rb', line 23 def to_s stem end |