lib/natural/stemmers/indonesian/stemmer_id.js
function stemPluralWord(plural_word){
    var matches = plural_word.match(/^(.*)-(.*)$/);
    if(!matches){
        return plural_word;
    }
    words = [matches[1], matches[2]];

    //malaikat-malaikat-nya -> malaikat malaikat-nya
    suffix = words[1];
    suffixes = ["ku", "mu", "nya", "lah", "kah", "tah", "pun"];
    matches = words[0].match(/^(.*)-(.*)$/);
    if(suffixes.indexOf(suffix) != -1 && matches){
        words[0] = matches[1];
        words[1] = matches[2] + '-' + suffix;
    }

    //berbalas-balasan -> balas
    rootWord1 = stemSingularWord(words[0]);
    rootWord2 = stemSingularWord(words[1]);

    //meniru-nirukan -> tiru
    if(!find(words[1]) && rootWord2==words[1]){
        rootWord2 = stemSingularWord("me" + words[1]);
    }
    if(rootWord1==rootWord2){
        return rootWord1;
    }
    else{
        return plural_word;
    }
}
function stemPluralWord(plural_word){
    var matches = plural_word.match(/^(.*)-(.*)$/);
    if(!matches){
        return plural_word;
    }
    words = [matches[1], matches[2]];

    //malaikat-malaikat-nya -> malaikat malaikat-nya
    suffix = words[1];
    suffixes = ["ku", "mu", "nya", "lah", "kah", "tah", "pun"];
    matches = words[0].match(/^(.*)-(.*)$/);
    if(suffixes.indexOf(suffix) != -1 && matches){
        words[0] = matches[1];
        words[1] = matches[2] + '-' + suffix;
    }

    //berbalas-balasan -> balas
    rootWord1 = stemSingularWord(words[0]);
    rootWord2 = stemSingularWord(words[1]);

    //meniru-nirukan -> tiru
    if(!find(words[1]) && rootWord2==words[1]){
        rootWord2 = stemSingularWord("me" + words[1]);
    }
    if(rootWord1==rootWord2){
        return rootWord1;
    }
    else{
        return plural_word;
    }
}
function stemPluralWord ( plural_word ) { var matches = plural_word . match ( / ^(.*)-(.*)$ / ) ; if ( ! matches ) { return plural_word ; } words = [ matches [ 1 ] , matches [ 2 ] ] ; //malaikat-malaikat-nya -> malaikat malaikat-nya suffix = words [ 1 ] ; suffixes = [ "ku" , "mu" , "nya" , "lah" , "kah" , "tah" , "pun" ] ; matches = words [ 0 ] . match ( / ^(.*)-(.*)$ / ) ; if ( suffixes . indexOf ( suffix ) != - 1 && matches ) { words [ 0 ] = matches [ 1 ] ; words [ 1 ] = matches [ 2 ] + '-' + suffix ; } //berbalas-balasan -> balas rootWord1 = stemSingularWord ( words [ 0 ] ) ; rootWord2 = stemSingularWord ( words [ 1 ] ) ; //meniru-nirukan -> tiru if ( ! find ( words [ 1 ] ) && rootWord2 == words [ 1 ] ) { rootWord2 = stemSingularWord ( "me" + words [ 1 ] ) ; } if ( rootWord1 == rootWord2 ) { return rootWord1 ; } else { return plural_word ; } }
Stem for plural word
Stem for plural word