就像python nltk(https://stackoverflow.com/a/10369407/3096792)中内置了Porter Stemmer一样,我想知道java apache opennlp中是否有内置的Porter Stemmer,尽管这个包下有一个接口(interface)[opennlp.tools .stemmer.Stemmer]。由于我现在不知道或不需要知道词干背后的算法,所以我需要 apache opennlp 工具包下的标准包。如果不存在,java中的替代方案是什么?
最佳答案
您可以使用 Apache Lucene Snowball 库 here
只需将此 jar 文件放入您的构建路径中并使用它
PorterStemmer stemmer = new PorterStemmer();
stemmer.setCurrent(input); //set string you need to stem
stemmer.stem(); //stem the word
stemmer.getCurrent();//get the stemmed word
关于java - java opennlp工具包中内置Porter Stemmer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28083377/