Implementation of the Porter Stemmer algorithm in Java, which is outlined here.
The algorithm retrieves the stem of the word and provides a cleaner system as similar words (i.e. generous and generosity) are very similar so queries results will be handled accordingly.
- Add the dependency to your
pom.xml
:
<dependency>
<groupId>io.github.hamzamemon</groupId>
<artifactId>porterstemmer</artifactId>
<version>1.0.4</version>
</dependency>
- Stem your word:
String stemmed = PorterStemmer.stem(word);