public function loopPengembalianAkhiran()
    {
        // restore prefix to form [DP+[DP+[DP]]] + Root word
        $this->restorePrefix();

        $removals = $this->removals;
        $reversedRemovals = array_reverse($removals);
        $currentWord = $this->getCurrentWord();

        foreach ($reversedRemovals as $removal) {
            if (!$this->isSuffixRemoval($removal)) {
                continue;
            }

            if ($removal->getRemovedPart() == 'kan') {
                $this->setCurrentWord($removal->getResult() . 'k');

                // step 4, 5
                $this->removePrefixes();
                if ($this->dictionary->contains($this->getCurrentWord())) {
                    return;
                }

                $this->setCurrentWord($removal->getResult() . 'kan');
            } else {
                $this->setCurrentWord($removal->getSubject());
            }

            // step 4, 5
            $this->removePrefixes();
            if ($this->dictionary->contains($this->getCurrentWord())) {
                return;
            }

            $this->removals = $removals;
            $this->setCurrentWord($currentWord);
        }
    }
public function loopPengembalianAkhiran()
    {
        // restore prefix to form [DP+[DP+[DP]]] + Root word
        $this->restorePrefix();

        $removals = $this->removals;
        $reversedRemovals = array_reverse($removals);
        $currentWord = $this->getCurrentWord();

        foreach ($reversedRemovals as $removal) {
            if (!$this->isSuffixRemoval($removal)) {
                continue;
            }

            if ($removal->getRemovedPart() == 'kan') {
                $this->setCurrentWord($removal->getResult() . 'k');

                // step 4, 5
                $this->removePrefixes();
                if ($this->dictionary->contains($this->getCurrentWord())) {
                    return;
                }

                $this->setCurrentWord($removal->getResult() . 'kan');
            } else {
                $this->setCurrentWord($removal->getSubject());
            }

            // step 4, 5
            $this->removePrefixes();
            if ($this->dictionary->contains($this->getCurrentWord())) {
                return;
            }

            $this->removals = $removals;
            $this->setCurrentWord($currentWord);
        }
    }
public function loopPengembalianAkhiran ( ) { // restore prefix to form [DP+[DP+[DP]]] + Root word $ this -> restorePrefix ( ) ; $ removals = $ this -> removals ; $ reversedRemovals = array_reverse ( $ removals ) ; $ currentWord = $ this -> getCurrentWord ( ) ; foreach ( $ reversedRemovals as $ removal ) { if ( ! $ this -> isSuffixRemoval ( $ removal ) ) { continue ; } if ( $ removal -> getRemovedPart ( ) == 'kan' ) { $ this -> setCurrentWord ( $ removal -> getResult ( ) . 'k' ) ; // step 4, 5 $ this -> removePrefixes ( ) ; if ( $ this -> dictionary -> contains ( $ this -> getCurrentWord ( ) ) ) { return ; } $ this -> setCurrentWord ( $ removal -> getResult ( ) . 'kan' ) ; } else { $ this -> setCurrentWord ( $ removal -> getSubject ( ) ) ; } // step 4, 5 $ this -> removePrefixes ( ) ; if ( $ this -> dictionary -> contains ( $ this -> getCurrentWord ( ) ) ) { return ; } $ this -> removals = $ removals ; $ this -> setCurrentWord ( $ currentWord ) ; } }
ECS Loop Pengembalian Akhiran
ECS Loop Pengembalian Akhiran