home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (CustomStemmingPreprocessor.java)

This example Java source code file (CustomStemmingPreprocessor.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

commonpreprocessor, customstemmingpreprocessor, override, snowballprogram, string

The CustomStemmingPreprocessor.java Java example source code

package org.deeplearning4j.text.tokenization.tokenizer.preprocessor;

import lombok.NonNull;
import org.tartarus.snowball.SnowballProgram;

 * This is StemmingPreprocessor compatible with different StemmingProcessors defined as lucene/tartarus SnowballProgram
 * Like, but not limited to: RussianStemmer, DutchStemmer, FrenchStemmer etc
 * PLEASE NOTE: This preprocessor is NOT thread-safe.
 * @author raver119@gmail.com
public class CustomStemmingPreprocessor extends CommonPreprocessor {
    private SnowballProgram stemmer;
    public CustomStemmingPreprocessor(@NonNull SnowballProgram stemmer) {
        this.stemmer = stemmer;

    public String preProcess(String token) {
        String prep = super.preProcess(token);
        return stemmer.getCurrent();

Other Java examples (source code examples)

Here is a short list of links related to this Java CustomStemmingPreprocessor.java source code file:

my book on functional programming


new blog posts


Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.