Package org.terrier.learning
Class FeaturedQueryResultSet
- java.lang.Object
-
- org.terrier.matching.CollectionResultSet
-
- org.terrier.matching.QueryResultSet
-
- org.terrier.learning.FeaturedQueryResultSet
-
- All Implemented Interfaces:
java.io.Serializable
,FeaturedResultSet
,ResultSet
public class FeaturedQueryResultSet extends QueryResultSet implements FeaturedResultSet
A result set implementation that accommodates multiple query feature scores, besides the original relevance scores.- Since:
- 4.0
- Author:
- Rodrygo Santos
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.terrier.matching.QueryResultSet
metadata, metaMap
-
Fields inherited from class org.terrier.matching.CollectionResultSet
arraysInitialised, docids, exactResultSize, lock, occurrences, resultSize, scores, statusCode
-
-
Constructor Summary
Constructors Constructor Description FeaturedQueryResultSet(int length)
FeaturedQueryResultSet(ResultSet resultSet)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDefaultLabel()
java.lang.String[]
getFeatureNames()
Gets the names of the features that have been added to this ResultSetdouble[]
getFeatureScores(int id)
Get the feature scores for a given feature iddouble[]
getFeatureScores(java.lang.String name)
Get all scores for the enabled docids given a feature namejava.lang.String[]
getLabels()
int
getNumberOfFeatures()
Number of features decorated for this resultsetResultSet
getResultSet(int[] positions)
Extracts a subset of the resultset given by the list parameter, which contains a list of positions in the resultset that should be saved.ResultSet
getResultSet(int startPosition, int length)
Crops the existing result file and extracts a subset from the given starting point to the ending point.protected QueryResultSet
makeNewResultSet(int length)
void
putFeatureScores(java.lang.String name, double[] scores)
Add a feature to this result setvoid
setDefaultLabel(java.lang.String defLabel)
void
setLabels(java.lang.String[] labels)
void
sort()
Sorts all documents in this resultset by descending scorevoid
sort(int topDocs)
Sorts the top topDocs document in this resultset be first.-
Methods inherited from class org.terrier.matching.QueryResultSet
addMetaItem, addMetaItems, addMetaType, allMetaItems, getMetaItem, getMetaItems, getMetaKeys, hasMetaItems, initialise
-
Methods inherited from class org.terrier.matching.CollectionResultSet
getDocids, getExactResultSize, getLock, getOccurrences, getResultSize, getScores, getStatusCode, initialise, setExactResultSize, setResultSize, setStatusCode
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.terrier.matching.ResultSet
addMetaItem, addMetaItems, allMetaItems, getDocids, getExactResultSize, getLock, getMetaItem, getMetaItems, getMetaKeys, getOccurrences, getResultSize, getScores, getStatusCode, hasMetaItems, initialise, initialise, setExactResultSize, setResultSize, setStatusCode
-
-
-
-
Constructor Detail
-
FeaturedQueryResultSet
public FeaturedQueryResultSet(ResultSet resultSet)
-
FeaturedQueryResultSet
public FeaturedQueryResultSet(int length)
-
-
Method Detail
-
getFeatureNames
public java.lang.String[] getFeatureNames()
Gets the names of the features that have been added to this ResultSet- Specified by:
getFeatureNames
in interfaceFeaturedResultSet
-
setLabels
public void setLabels(java.lang.String[] labels)
- Specified by:
setLabels
in interfaceFeaturedResultSet
-
getLabels
public java.lang.String[] getLabels()
- Specified by:
getLabels
in interfaceFeaturedResultSet
-
setDefaultLabel
public void setDefaultLabel(java.lang.String defLabel)
- Specified by:
setDefaultLabel
in interfaceFeaturedResultSet
-
getDefaultLabel
public java.lang.String getDefaultLabel()
- Specified by:
getDefaultLabel
in interfaceFeaturedResultSet
-
putFeatureScores
public void putFeatureScores(java.lang.String name, double[] scores)
Add a feature to this result set- Specified by:
putFeatureScores
in interfaceFeaturedResultSet
-
getFeatureScores
public double[] getFeatureScores(java.lang.String name)
Get all scores for the enabled docids given a feature name- Specified by:
getFeatureScores
in interfaceFeaturedResultSet
-
getFeatureScores
public double[] getFeatureScores(int id)
Get the feature scores for a given feature id- Specified by:
getFeatureScores
in interfaceFeaturedResultSet
-
getNumberOfFeatures
public int getNumberOfFeatures()
Number of features decorated for this resultset- Specified by:
getNumberOfFeatures
in interfaceFeaturedResultSet
-
getResultSet
public ResultSet getResultSet(int startPosition, int length)
Crops the existing result file and extracts a subset from the given starting point to the ending point.- Specified by:
getResultSet
in interfaceResultSet
- Overrides:
getResultSet
in classQueryResultSet
- Parameters:
startPosition
- the beginning of the subset.length
- the number of entries to get.- Returns:
- a subset of the current result set.
-
getResultSet
public ResultSet getResultSet(int[] positions)
Extracts a subset of the resultset given by the list parameter, which contains a list of positions in the resultset that should be saved.- Specified by:
getResultSet
in interfaceResultSet
- Overrides:
getResultSet
in classQueryResultSet
- Parameters:
positions
- int[] the list of elements in the current list that should be kept.- Returns:
- a subset of the current result set specified by the list.
-
makeNewResultSet
protected QueryResultSet makeNewResultSet(int length)
- Overrides:
makeNewResultSet
in classQueryResultSet
-
sort
public void sort()
Description copied from interface:ResultSet
Sorts all documents in this resultset by descending score- Specified by:
sort
in interfaceResultSet
- Overrides:
sort
in classQueryResultSet
-
sort
public void sort(int topDocs)
Description copied from interface:ResultSet
Sorts the top topDocs document in this resultset be first. The order of the remaining documents is undefined.- Specified by:
sort
in interfaceResultSet
- Overrides:
sort
in classQueryResultSet
- Parameters:
topDocs
- number of documents to top-rank
-
-