Sha256: ddcf776f7a5ec59855b3c6a4cfc25450d49281be4ffaee8b6a1843dbcf358a6c

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

module Sastrawi
  module Stemmer
    module Context
      module Visitor
        class RemovePlainPrefix
          def visit(context)
            result = remove(context.current_word)

            if result != context.current_word
              removed_part = context.current_word.sub(result, '')

              removal = Removal.new(self, context.current_word, result, removed_part, 'DP')

              context.add_removal(removal)
              context.current_word = result
            end
          end

          def remove(word)
            word.sub(/^(di|ke|se)/, '')
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sastrawi-0.1.0.pre lib/sastrawi/stemmer/context/visitor/remove_plain_prefix.rb