1: <?php
2: /**
3: * Sastrawi (https://github.com/sastrawi/sastrawi)
4: *
5: * @link http://github.com/sastrawi/sastrawi for the canonical source repository
6: * @license https://github.com/sastrawi/sastrawi/blob/master/LICENSE The MIT License (MIT)
7: */
8:
9: namespace Sastrawi\Morphology\Disambiguator;
10:
11: /**
12: * Disambiguate Prefix Rule 9
13: * Rule 9 : te-C1erC2 -> te-C1erC2 where C1 != 'r'
14: */
15: class DisambiguatorPrefixRule9 implements DisambiguatorInterface
16: {
17: /**
18: * Disambiguate Prefix Rule 9
19: * Rule 9 : te-C1erC2 -> te-C1erC2 where C1 != 'r'
20: */
21: public function disambiguate($word)
22: {
23: $matches = null;
24: $contains = preg_match('/^te([bcdfghjklmnpqrstvwxyz])er([bcdfghjklmnpqrstvwxyz])(.*)$/', $word, $matches);
25:
26: if ($contains === 1) {
27: if ($matches[1] === 'r') {
28: return;
29: }
30:
31: return $matches[1] . 'er' . $matches[2] . $matches[3];
32: }
33: }
34: }
35: