public class DocumentClassifierME extends Object implements DocumentClassifier
DocumentClassifier.| Constructor and Description |
|---|
DocumentClassifierME(DocumentClassifierModel model)
Initializes the current instance with a DocumentClassifier model.
|
| Modifier and Type | Method and Description |
|---|---|
String |
classify(String[] text)
Classifies the given text, provided in separate tokens.
|
double[] |
classifyProb(String[] text)
Classify the given text provided as tokens.
|
void |
clearFeatureData()
Forgets all adaptive data which was collected during previous calls to one
of the find methods.
|
String |
getAllLabels(double[] results)
Get the label associated with the given probabilities.
|
String |
getBestLabel(double[] outcome)
Get the best label from previously generated outcome probabilities.
|
int |
getIndex(String category)
Get the index of a certain label.
|
String |
getLabel(int index)
Get the category at a given index.
|
int |
getNumberOfLabels()
get the number of found labels.
|
Map<String,Double> |
scoreMap(String[] text)
Returns a map in which the key is the label 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 DocumentClassifierModel |
train(String languageCode,
opennlp.tools.util.ObjectStream<DocSample> samples,
opennlp.tools.util.TrainingParameters mlParams,
DocumentClassifierFactory factory) |
public DocumentClassifierME(DocumentClassifierModel model)
model - the document classifier modelpublic String classify(String[] text)
DocumentClassifierclassify in interface DocumentClassifiertext - the tokens of text to classifypublic double[] classifyProb(String[] text)
classifyProb in interface DocumentClassifiertext - text tokens to classifypublic String getBestLabel(double[] outcome)
DocumentClassifiergetBestLabel in interface DocumentClassifieroutcome - a vector of outcome probabilitiespublic Map<String,Double> scoreMap(String[] text)
scoreMap in interface DocumentClassifiertext - the input text to classifypublic SortedMap<Double,Set<String>> sortedScoreMap(String[] text)
sortedScoreMap in interface DocumentClassifiertext - the input text to classifypublic int getIndex(String category)
DocumentClassifiergetIndex in interface DocumentClassifiercategory - the labelpublic String getLabel(int index)
DocumentClassifiergetLabel in interface DocumentClassifierindex - the indexpublic int getNumberOfLabels()
DocumentClassifiergetNumberOfLabels in interface DocumentClassifierpublic String getAllLabels(double[] results)
DocumentClassifiergetAllLabels in interface DocumentClassifierresults - the probabilities of each labelpublic void clearFeatureData()
clearFeatureData in interface DocumentClassifierpublic static DocumentClassifierModel train(String languageCode, opennlp.tools.util.ObjectStream<DocSample> samples, opennlp.tools.util.TrainingParameters mlParams, DocumentClassifierFactory factory) throws IOException
IOExceptionCopyright © 2017 IXA pipes. All rights reserved.