1: <?php
2: 3: 4: 5: 6: 7:
8:
9: namespace Sastrawi\Morphology;
10:
11: use Sastrawi\Specification\SpecificationInterface;
12:
13: 14: 15: 16:
17: class InvalidAffixPairSpecification implements SpecificationInterface
18: {
19: public function isSatisfiedBy($word)
20: {
21: if (preg_match('/^me(.*)kan$/', $word) === 1) {
22: return false;
23: }
24:
25: if ($word == 'ketahui') {
26: return false;
27: }
28:
29: $invalidAffixes = array(
30: '/^ber(.*)i$/',
31: '/^di(.*)an$/',
32: '/^ke(.*)i$/',
33: '/^ke(.*)an$/',
34: '/^me(.*)an$/',
35: '/^me(.*)an$/',
36: '/^ter(.*)an$/',
37: '/^per(.*)an$/',
38: );
39:
40: $contains = false;
41:
42: foreach ($invalidAffixes as $invalidAffix) {
43: $contains = $contains || preg_match($invalidAffix, $word) === 1;
44: }
45:
46: return $contains;
47: }
48: }
49: