package cn.edu.bjut.chapter2; import opennlp.tools.stemmer.PorterStemmer; public class Stemmer { public static String stem(String token) { PorterStemmer stemmer = new PorterStemmer(); return stemmer.stem(token); } public static void main(String[] args) { String[] words = { "running", "jumps", "better", "happily" }; for (String word : words) { String stem = stem(word); System.out.println(word + "-->" + stem); } } }