Class: Sastrawi::Stemmer::Context::Visitor::RemoveInflectionalPossessivePronoun
- Inherits:
-
Object
- Object
- Sastrawi::Stemmer::Context::Visitor::RemoveInflectionalPossessivePronoun
- Defined in:
- lib/sastrawi/stemmer/context/visitor/remove_inflectional_possessive_pronoun.rb
Instance Method Summary collapse
-
#remove(word) ⇒ Object
Remove inflectional possessive pronoun: ku|mu|nya|.
- #visit(context) ⇒ Object
Instance Method Details
#remove(word) ⇒ Object
Remove inflectional possessive pronoun: ku|mu|nya|
27 28 29 |
# File 'lib/sastrawi/stemmer/context/visitor/remove_inflectional_possessive_pronoun.rb', line 27 def remove(word) word.sub(/-*(ku|mu|nya)$/, '') end |
#visit(context) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sastrawi/stemmer/context/visitor/remove_inflectional_possessive_pronoun.rb', line 11 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 |