Sha256: de21a9e49b9f585d3bede087be00237f81d5826bd025db09490303d48ebbacda

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

module Sastrawi
  module Stemmer
    module Context
      module Visitor
        class RemoveInflectionalParticle
          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, 'P')

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

          def remove(word)
            word.sub(/-*(lah|kah|tah|pun)$/, '')
          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_inflectional_particle.rb