All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.optimaize.langdetect.text.TextObjectFactoryBuilder Maven / Gradle / Ivy

The newest version!
package com.optimaize.langdetect.text;

import java.util.ArrayList;
import java.util.List;

/**
 * Builder for {@link com.optimaize.langdetect.text.TextObjectFactory}.
 *
 * @author Fabian Kessler
 */
public class TextObjectFactoryBuilder {

    private int maxTextLength = 0;
    private final List textFilters = new ArrayList<>();

    /**
     * @param maxTextLength 0 for no limit (that's the default).
     */
    public TextObjectFactoryBuilder maxTextLength(int maxTextLength) {
        this.maxTextLength = maxTextLength;
        return this;
    }


    /**
     * Adds the given TextFilter to be run on {@link TextObject#append} methods.
     *
     * 

Note that the order of filters. may be important. They are executed in the same order as they * are passed in here.

*/ public TextObjectFactoryBuilder withTextFilter(TextFilter textFilter) { textFilters.add(textFilter); return this; } public TextObjectFactory build() { return new TextObjectFactory( new MultiTextFilter(textFilters), maxTextLength ); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy