1: <?php
2: 3: 4: 5: 6: 7:
8:
9: namespace Sastrawi\Stemmer\Context\Visitor;
10:
11: use Sastrawi\Stemmer\Context\ContextInterface;
12: use Sastrawi\Stemmer\Context\Removal;
13:
14: 15: 16: 17: 18: 19:
20: class RemoveInflectionalPossessivePronoun implements VisitorInterface
21: {
22: public function visit(ContextInterface $context)
23: {
24: $result = $this->remove($context->getCurrentWord());
25:
26: if ($result != $context->getCurrentWord()) {
27: $removedPart = preg_replace("/$result/", '', $context->getCurrentWord(), 1);
28:
29: $removal = new Removal(
30: $this,
31: $context->getCurrentWord(),
32: $result,
33: $removedPart,
34: 'PP'
35: );
36:
37: $context->addRemoval($removal);
38: $context->setCurrentWord($result);
39: }
40: }
41:
42: 43: 44: 45:
46: public function remove($word)
47: {
48: return preg_replace('/(ku|mu|nya)$/', '', $word, 1);
49: }
50: }
51: