Sha256: 912d04c07c24351e641797553f212dc97c4b3a91f7439935800d48d8cd331a88

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 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(/#{Regexp.quote(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 lib/sastrawi/stemmer/context/visitor/remove_plain_prefix.rb