public class RankedClassification extends Classification
RankedClassification
provides a classification with
an ordered n-best list of category results. Subclasses of this
class add scores with various interpretations to the ranked n-best
results.Constructor and Description |
---|
RankedClassification(String[] categories)
Construct a ranked classification with the specified results
ordered from best to worst.
|
Modifier and Type | Method and Description |
---|---|
String |
category(int rank)
Returns the category with the specified rank in the
classification.
|
int |
size()
Returns the number of categories in this classification.
|
String |
toString()
Returns a string-based representation of this ranked
classification.
|
bestCategory
public RankedClassification(String[] categories)
null
if the
specfied array of categories is empty.
Note that the categories are simply stored as part of this ranked classification, not copied, so any subsequent change to the category array will affect this ranked classification.
categories
- Result categories, in order from best to worst.public int size()
public String category(int rank)
rank
- Rank of result the category of which is to be returned.IllegalArgumentException
- If the rank is out of range.public String toString()
toString
in class Classification