Overview

Namespaces

  • PHP
  • Sastrawi
    • Dictionary
    • Morphology
      • Disambiguator
    • Specification
    • Stemmer
      • Cache
      • ConfixStripping
      • Context
        • Visitor
      • Filter
    • StopWordRemover

Classes

  • InvalidAffixPairSpecification
  • Overview
  • Namespace
  • Class
  • Tree
 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;
10: 
11: use Sastrawi\Specification\SpecificationInterface;
12: 
13: /**
14:  * Asian J. (2007) “Effective Techniques for Indonesian Text Retrieval”. page 26
15:  * @link http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf
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: 
API documentation generated by ApiGen 2.8.0