Sha256: 8e7df2978947fd8d6ac77a37b560e134febfb98852503b1ba5d38826cac703a9

Contents?: true

Size: 930 Bytes

Versions: 4

Compression:

Stored size: 930 Bytes

Contents

##
# Remove inflectional possessive pronoun
# Asian J. (2007) "Effective Techniques for Indonesia Text Retrieval" page 60
# http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf

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

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

          ##
          # Remove inflectional possessive pronoun: ku|mu|nya|

          def remove(word)
            word.sub(/-*(ku|mu|nya)$/, '')
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sastrawi-0.1.4 lib/sastrawi/stemmer/context/visitor/remove_inflectional_possessive_pronoun.rb
sastrawi-0.1.3 lib/sastrawi/stemmer/context/visitor/remove_inflectional_possessive_pronoun.rb
sastrawi-0.1.2 lib/sastrawi/stemmer/context/visitor/remove_inflectional_possessive_pronoun.rb
sastrawi-0.1.1 lib/sastrawi/stemmer/context/visitor/remove_inflectional_possessive_pronoun.rb