Sha256: 3ca1d4c4376ed5c82fb11be945301d3beff93f9e94c8bac536d9a65818b62817
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require "indonesian_stemmer/version" require "indonesian_stemmer/morphological_utility" module IndonesianStemmer class << self include MorphologicalUtility attr_accessor :number_of_syllables def stem(word, derivational_stemming = true) @flags = 0 @number_of_syllables = total_syllables word remove_particle(word) if still_has_many_syllables? remove_possessive_pronoun(word) if still_has_many_syllables? stem_derivational(word) if derivational_stemming word end private def stem_derivational(word) previous_size = word.size remove_first_order_prefix(word) if still_has_many_syllables? if previous_size != word.size previous_size = word.size remove_suffix(word) if still_has_many_syllables? if previous_size != word.size remove_second_order_prefix(word) if still_has_many_syllables? end else remove_second_order_prefix(word) if still_has_many_syllables? remove_suffix(word) if still_has_many_syllables? end end def still_has_many_syllables? @number_of_syllables > 2 end end end class String def stem IndonesianStemmer.stem(self) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
indonesian_stemmer-0.1.0 | lib/indonesian_stemmer.rb |
indonesian_stemmer-0.0.1 | lib/indonesian_stemmer.rb |