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

com.mayabot.nlp.segment.plugins.customwords.CustomDictionaryPlugin Maven / Gradle / Ivy

package com.mayabot.nlp.segment.plugins.customwords;

import com.mayabot.nlp.segment.pipeline.PipelineLexerBuilder;
import com.mayabot.nlp.segment.pipeline.PipelineLexerPlugin;

public class CustomDictionaryPlugin implements PipelineLexerPlugin {

    private CustomDictionary customDictionary;

    public CustomDictionaryPlugin(CustomDictionary customDictionary) {
        this.customDictionary = customDictionary;
    }

    public CustomDictionaryPlugin() {
    }


    @Override
    public void init(PipelineLexerBuilder builder) {
        CustomDictionary temp;
        if (customDictionary == null) {
            temp = builder.getMynlp().getInstance(CustomDictionary.class);
        } else {
            temp = customDictionary;
        }

        builder.addProcessor(new CustomDictionaryProcessor(temp));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy