public class DocumentCategorizerME extends Object implements DocumentCategorizer
DocumentCategorizer.| Constructor and Description | 
|---|
| DocumentCategorizerME(DoccatModel model)Initializes the current instance with a doccat model. | 
| Modifier and Type | Method and Description | 
|---|---|
| double[] | categorize(String[] text)Categorizes the given text. | 
| double[] | categorize(String[] text,
          Map<String,Object> extraInformation)Categorize the given text provided as tokens along with
 the provided extra information | 
| String | getAllResults(double[] results)get the name of the category associated with the given probabilties | 
| String | getBestCategory(double[] outcome)get the best category from previously generated outcome probabilities | 
| String | getCategory(int index)get the category at a given index | 
| int | getIndex(String category)get the index of a certain category | 
| int | getNumberOfCategories()get the number of categories | 
| Map<String,Double> | scoreMap(String[] text)Returns a map in which the key is the category name and the value is the score | 
| SortedMap<Double,Set<String>> | sortedScoreMap(String[] text)Returns a map with the score as a key in ascending order. | 
| static DoccatModel | train(String languageCode,
     ObjectStream<DocumentSample> samples,
     TrainingParameters mlParams,
     DoccatFactory factory) | 
public DocumentCategorizerME(DoccatModel model)
model - the doccat modelpublic double[] categorize(String[] text, Map<String,Object> extraInformation)
categorize in interface DocumentCategorizertext - text tokens to categorizeextraInformation - additional informationpublic double[] categorize(String[] text)
categorize in interface DocumentCategorizertext - the text to categorizepublic Map<String,Double> scoreMap(String[] text)
scoreMap in interface DocumentCategorizertext - the input text to classifypublic SortedMap<Double,Set<String>> sortedScoreMap(String[] text)
sortedScoreMap in interface DocumentCategorizertext - the input text to classifypublic String getBestCategory(double[] outcome)
DocumentCategorizergetBestCategory in interface DocumentCategorizeroutcome - a vector of outcome probabilitiespublic int getIndex(String category)
DocumentCategorizergetIndex in interface DocumentCategorizercategory - the categorypublic String getCategory(int index)
DocumentCategorizergetCategory in interface DocumentCategorizerindex - the indexpublic int getNumberOfCategories()
DocumentCategorizergetNumberOfCategories in interface DocumentCategorizerpublic String getAllResults(double[] results)
DocumentCategorizergetAllResults in interface DocumentCategorizerresults - the probabilities of each categorypublic static DoccatModel train(String languageCode, ObjectStream<DocumentSample> samples, TrainingParameters mlParams, DoccatFactory factory) throws IOException
IOExceptionCopyright © 2018 The Apache Software Foundation. All rights reserved.