简体   繁体   中英

Lucene 4.1.0 Porter Stemmer not work properly

I work with my App in Java and i use Lucene 4.1.0 to use Porter Stemmer method. I have read and implementing this

this is my code

import org.apache.lucene.analysis.snowball.*;
import org.tartarus.snowball.ext.PorterStemmer;


 private String stemmer(String word){
        PorterStemmer obj = new PorterStemmer();
        obj.setCurrent(word);
        obj.stem();
        return obj.getCurrent();
}

this method works, but Porter Stemmer did not work properly for some words eg :

  1. source >> sourc
  2. coupled >> coupl
  3. accompanying >> accompani

Maybe theres a bug in the algorithm? How to solve this problem?

Porter Stemmer Algorithm is expected to convert source >> sourc. Please read more about porter stemmer algorithm from here

You can use a word suggester on top of porter stemmer. For word suggestion you can use "suggester basic in java"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM