how to perform stemming in java?

Hello, here i written a code for stemming a word in java.
For it you need a java library, you can download it from here, and load it to you lib folder.

Here is the code:

import org.tartarus.snowball.*;

public class EnglishStemmer_porterstemmer {

public static void main(String[] args) throws Exception{
       
//enter the word in the string.
 String a="phones";
     
    a=EnglishSnowballStemmerFactory.getInstance().process(a);
    System.out.println(a);
    }
}

Output: phone



See also:

Comments

Post a comment

Popular posts from this blog

Accounting Multiple Choice Questions with answers | Download PDF for MCQs

Difference between Data Mining and Knowledge Discovery (KDD)