Class DocumentCategorizerME

    • Constructor Detail

      • DocumentCategorizerME

        public DocumentCategorizerME​(DoccatModel model)
        Initializes a DocumentCategorizerME instance with a doccat model. Default feature generation is used.
        Parameters:
        model - the DoccatModel to be used for categorization.
    • Method Detail

      • categorize

        public double[] categorize​(String[] text,
                                   Map<String,​Object> extraInformation)
        Categorize the given text provided as tokens along with the provided extra information.
        Specified by:
        categorize in interface DocumentCategorizer
        Parameters:
        text - The text tokens to categorize.
        extraInformation - Additional information for context to be used by the feature generator.
        Returns:
        The per category probabilities.
      • categorize

        public double[] categorize​(String[] text)
        Description copied from interface: DocumentCategorizer
        Categorizes the given text, provided in separate tokens.
        Specified by:
        categorize in interface DocumentCategorizer
        Parameters:
        text - The tokens of text to categorize.
        Returns:
        The per category probabilities.
      • getBestCategory

        public String getBestCategory​(double[] outcome)
        Description copied from interface: DocumentCategorizer
        Retrieves the best category from previously generated outcome probabilities
        Specified by:
        getBestCategory in interface DocumentCategorizer
        Parameters:
        outcome - An array of computed outcome probabilities.
        Returns:
        The best category represented as String.
      • getIndex

        public int getIndex​(String category)
        Description copied from interface: DocumentCategorizer
        Retrieves the index of a certain category.
        Specified by:
        getIndex in interface DocumentCategorizer
        Parameters:
        category - The category for which the index is to be found.
        Returns:
        The index.
      • getCategory

        public String getCategory​(int index)
        Description copied from interface: DocumentCategorizer
        Retrieves the category at a given index.
        Specified by:
        getCategory in interface DocumentCategorizer
        Parameters:
        index - The index for which the category shall be found.
        Returns:
        The category represented as String.
      • getAllResults

        public String getAllResults​(double[] results)
        Description copied from interface: DocumentCategorizer
        Retrieves the name of the category associated with the given probabilities.
        Specified by:
        getAllResults in interface DocumentCategorizer
        Parameters:
        results - The probabilities of each category.
        Returns:
        The name of the outcome.