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\Context\Visitor;
10:
11: use Sastrawi\Stemmer\Context\ContextInterface;
12:
13: class DontStemShortWord implements VisitorInterface
14: {
15: public function visit(ContextInterface $context)
16: {
17: if ($this->isShortWord($context->getCurrentWord())) {
18: $context->stopProcess();
19: }
20: }
21:
22: /**
23: * @param string $word
24: */
25: protected function isShortWord($word)
26: {
27: return (strlen($word) <= 3);
28: }
29: }
30: