lib/natural/stemmers/indonesian/stemmer_id.js
function loopRestorePrefixes(){
    restorePrefix();

    var reversed_removals = removals.reverse();
    var temp_current_word = current_word;

    for(var i in reversed_removals){
        current_removal = reversed_removals[i];

        if(!isSuffixRemovals(current_removal)){
            continue
        }

        if(current_removal.getRemovedPart() == "kan"){
            current_word = current_removal.getResult() + "k";

            // Step 4, 5
            removePrefixes();
            if(find(current_word))
                return
            current_word = current_removal.getResult() + "kan";
        }
        else{
            current_word = current_removal.getOriginalWord();
        }

        // Step 4, 5
        removePrefixes();
        if(find(current_word))
            return

        current_word = temp_current_word;
    }
}
function loopRestorePrefixes(){
    restorePrefix();

    var reversed_removals = removals.reverse();
    var temp_current_word = current_word;

    for(var i in reversed_removals){
        current_removal = reversed_removals[i];

        if(!isSuffixRemovals(current_removal)){
            continue
        }

        if(current_removal.getRemovedPart() == "kan"){
            current_word = current_removal.getResult() + "k";

            // Step 4, 5
            removePrefixes();
            if(find(current_word))
                return
            current_word = current_removal.getResult() + "kan";
        }
        else{
            current_word = current_removal.getOriginalWord();
        }

        // Step 4, 5
        removePrefixes();
        if(find(current_word))
            return

        current_word = temp_current_word;
    }
}
function loopRestorePrefixes ( ) { restorePrefix ( ) ; var reversed_removals = removals . reverse ( ) ; var temp_current_word = current_word ; for ( var i in reversed_removals ) { current_removal = reversed_removals [ i ] ; if ( ! isSuffixRemovals ( current_removal ) ) { continue } if ( current_removal . getRemovedPart ( ) == "kan" ) { current_word = current_removal . getResult ( ) + "k" ; // Step 4, 5 removePrefixes ( ) ; if ( find ( current_word ) ) return current_word = current_removal . getResult ( ) + "kan" ; } else { current_word = current_removal . getOriginalWord ( ) ; } // Step 4, 5 removePrefixes ( ) ; if ( find ( current_word ) ) return current_word = temp_current_word ; } }
Loop Restore Prefixes
Loop Restore Prefixes