com.aliasi.classify
Class RankedClassification

java.lang.Object
  extended by com.aliasi.classify.Classification
      extended by com.aliasi.classify.RankedClassification
Direct Known Subclasses:
ScoredClassification

public class RankedClassification
extends Classification

A 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.

Since:
LingPipe2.0
Version:
2.0
Author:
Bob Carpenter

Constructor Summary
RankedClassification(String[] categories)
          Construct a ranked classification with the specified results ordered from best to worst.
 
Method Summary
 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.
 
Methods inherited from class com.aliasi.classify.Classification
bestCategory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RankedClassification

public RankedClassification(String[] categories)
Construct a ranked classification with the specified results ordered from best to worst. The best category will be the first category in the array, or 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.

Parameters:
categories - Result categories, in order from best to worst.
Method Detail

size

public int size()
Returns the number of categories in this classification.

Returns:
The number of categories in this classification.

category

public String category(int rank)
Returns the category with the specified rank in the classification. Ranks are numbered from zero and thus will be greater than or equal to zero and less than the size of this classification.

Parameters:
rank - Rank of result the category of which is to be returned.
Returns:
The category with the specified rank.
Throws:
IllegalArgumentException - If the rank is out of range.

toString

public String toString()
Returns a string-based representation of this ranked classification.

Overrides:
toString in class Classification
Returns:
A string-based representation of this classification.