Overview

Namespaces

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

Classes

  • PrecedenceAdjustmentSpecification
  • 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\Stemmer\ConfixStripping;
10: 
11: use Sastrawi\Specification\SpecificationInterface;
12: 
13: /**
14:  * Confix Stripping Rule Precedence Adjustment Specification.
15:  * Asian J. (2007) “Effective Techniques for Indonesian Text Retrieval” page 78-79.
16:  *
17:  * @link   http://researchbank.rmit.edu.au/eserv/rmit:6312/Asian.pdf
18:  */
19: class PrecedenceAdjustmentSpecification implements SpecificationInterface
20: {
21:     /**
22:      * @param  string  $value
23:      * @return boolean
24:      */
25:     public function isSatisfiedBy($value)
26:     {
27:         $regexRules = array(
28:             '/^be(.*)lah$/',
29:             '/^be(.*)an$/',
30:             '/^me(.*)i$/',
31:             '/^di(.*)i$/',
32:             '/^pe(.*)i$/',
33:             '/^ter(.*)i$/',
34:         );
35: 
36:         foreach ($regexRules as $rule) {
37:             if (preg_match($rule, $value)) {
38:                 return true;
39:             }
40:         }
41: 
42:         return false;
43:     }
44: }
45: 
API documentation generated by ApiGen 2.8.0