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 16
13: * Original Nazief and Adriani's Rule 16 : meng{g|h|q} -> meng-{g|h|q}
14: * Modified Jelita Asian's CS Rule 16 : meng{g|h|q|k} -> meng-{g|h|q|k} to stem mengkritik
15: */
16: class DisambiguatorPrefixRule16 implements DisambiguatorInterface
17: {
18: /**
19: * Disambiguate Prefix Rule 16
20: * Original Nazief and Adriani's Rule 16 : meng{g|h|q} -> meng-{g|h|q}
21: * Modified Jelita Asian's CS Rule 16 : meng{g|h|q|k} -> meng-{g|h|q|k} to stem mengkritik
22: */
23: public function disambiguate($word)
24: {
25: $matches = null;
26: $contains = preg_match('/^meng([g|h|q|k])(.*)$/', $word, $matches);
27:
28: if ($contains === 1) {
29: return $matches[1] . $matches[2];
30: }
31: }
32: }
33: