Question

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 e.g :

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

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

Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top