Class CategorizerImpl

    • Constructor Detail

      • CategorizerImpl

        protected CategorizerImpl()
        Categorizer constructor that prepares the files needed to train the Model in the languages added to the Language Enumeration Class.

        This class is private due to the method train(String)

    • Method Detail

      • getInstance

        public static CategorizerImpl getInstance()
        Description copied from interface: Categorizer
        gets the instance of the class, if the instance is null it calls the constructor to create a new instance
        Returns:
        Categorizer the instance of the class.
      • train

        public opennlp.tools.doccat.DoccatModel train​(String lang)
        Description copied from interface: Categorizer
        This method takes a lot of time to execute since it prepares the training Model for the categorizer based on the training Data provided in the CategorizerImpl() constructor} For optimization purposes, we Have used a singleton
        Specified by:
        train in interface Categorizer
        Parameters:
        lang - a string value representing the language in which the model will be trained. It also references the file to be used to train the Model
        Returns:
        instance of DoccatModel which is the trained model.
        See Also:
        ObjectStream, DoccatModel, TrainingParameters, DoccatFactory, DocumentSampleStream, DocumentSample, DocumentCategorizerME, MarkableFileInputStreamFactory, PlainTextByLineStream