public class TRECQrelsInMemory extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TRECQrelsInMemory.QrelsHashSet
Models the set of relevant documents for one query.
|
Modifier and Type | Field and Description |
---|---|
protected File[] |
fqrels
An array with the qrels files.
|
protected static org.apache.log4j.Logger |
logger |
TRECQrelsInMemory.QrelsHashSet[] |
qrelsPerQuery
Each element in the array contains the docids of the
relevant documents with respect to a query.
|
int |
totalNumberOfRelevantDocs
The total number of relevant documents.
|
Constructor and Description |
---|
TRECQrelsInMemory()
* A default constructor that creates an instance of the class
and loads in memory the relevance assessments from the files
that are specified in the file specified by the property
TREC_QRELS.
|
TRECQrelsInMemory(String qrelsFilename)
A constructor that creates an instance of the class
and loads in memory the relevance assessments from the
given file.
|
TRECQrelsInMemory(String[] qrelsFilenames)
A constructor that creates an instance of the class
and loads in memory the relevance assessments from the
given files.
|
Modifier and Type | Method and Description |
---|---|
gnu.trove.THashSet<String> |
getAllRelevantDocuments()
Get the identifiers of all relevant documents in the pool.
|
String[] |
getAllRelevantDocumentsToArray()
Get the identifiers of all relevant documents in the pool.
|
int |
getGrade(String qid,
String docno,
int def)
Returns the grade of a document for a given query.
|
gnu.trove.THashSet<String> |
getNonRelevantDocuments()
Get all the pooled non-relevant documents.
|
gnu.trove.THashSet<String> |
getNonRelevantDocuments(String queryid)
Get the pooled non-relevant documents for the given query.
|
String[] |
getNonRelevantDocumentsToArray()
Get all the pooled non-relevant documents.
|
String[] |
getNonRelevantDocumentsToArray(String queryid)
Get the pooled non-relevant documents for a given query.
|
int |
getNumberOfQueries()
Returns the total number of queries contained in the
loaded relevance assessments.
|
int |
getNumberOfRelevant(String queryid)
Returns the numbe of relevant documents for a given query.
|
String[] |
getQueryids()
Get ids of the queries that appear in the pool.
|
gnu.trove.THashSet<String> |
getRelevantDocuments(int grade)
Get the identifiers of all relevant documents in the pool with a given
relevance grade.
|
String[] |
getRelevantDocuments(int[] grades)
Get the identifiers of all relevant documents with the given relevance grades.
|
gnu.trove.THashSet<String> |
getRelevantDocuments(String queryid)
Get the pooled relevant documents for the given query.
|
gnu.trove.THashSet<String> |
getRelevantDocuments(String queryid,
int grade)
Get the pooled relevant documents for the given query.
|
gnu.trove.THashSet<String> |
getRelevantDocuments(String queryid,
int[] grades)
Get the pooled relevant documents for the given query.
|
String[] |
getRelevantDocumentsToArray(int grade)
Get the identifiers of all relevant documents in the pool with the given
relevance grade.
|
String[] |
getRelevantDocumentsToArray(String queryid)
Get the pooled relevant documents for a given query.
|
String[] |
getRelevantDocumentsToArray(String queryid,
int grade)
Get the pooled relevant documents for a given query.
|
String[] |
getRelevantDocumentsToArray(String queryid,
int[] grades)
Get the pooled relevant documents for the given query.
|
boolean |
isRelevant(String queryid,
String docno)
Check if the given document is relevant for a given query.
|
protected void |
loadQrelsFile()
Load in memory the relevance assessment files that are
specified in the array fqrels.
|
static String |
parseTRECQueryNo(String queryid) |
boolean |
queryExistInQrels(String queryid)
Checks whether there is a query with a given identifier
in the relevance assessments.
|
protected static final org.apache.log4j.Logger logger
public TRECQrelsInMemory.QrelsHashSet[] qrelsPerQuery
protected File[] fqrels
public int totalNumberOfRelevantDocs
public TRECQrelsInMemory(String qrelsFilename)
qrelsFilename
- String The full path of the qrels file to load.public TRECQrelsInMemory(String[] qrelsFilenames)
qrelsFilenames
- String[] The full path of the qrels files to load.public TRECQrelsInMemory()
public String[] getQueryids()
public String[] getRelevantDocuments(int[] grades)
grades
- The relevance grades.public gnu.trove.THashSet<String> getAllRelevantDocuments()
public gnu.trove.THashSet<String> getRelevantDocuments(int grade)
public String[] getAllRelevantDocumentsToArray()
public String[] getRelevantDocumentsToArray(int grade)
public gnu.trove.THashSet<String> getNonRelevantDocuments(String queryid)
queryid
- The id of the given query.public gnu.trove.THashSet<String> getNonRelevantDocuments()
public String[] getNonRelevantDocumentsToArray()
public gnu.trove.THashSet<String> getRelevantDocuments(String queryid)
queryid
- The id of the given query.public gnu.trove.THashSet<String> getRelevantDocuments(String queryid, int grade)
queryid
- The id of the given query.public gnu.trove.THashSet<String> getRelevantDocuments(String queryid, int[] grades)
queryid
- The id of the given query.public String[] getRelevantDocumentsToArray(String queryid, int[] grades)
queryid
- The id of the given query.public String[] getNonRelevantDocumentsToArray(String queryid)
queryid
- The id of the given query.public String[] getRelevantDocumentsToArray(String queryid)
queryid
- The id of the given query.public String[] getRelevantDocumentsToArray(String queryid, int grade)
queryid
- The id of the given query.public int getNumberOfQueries()
public int getNumberOfRelevant(String queryid)
queryid
- String The identifier of a query.protected void loadQrelsFile()
public boolean queryExistInQrels(String queryid)
queryid
- String the identifier of a query.public boolean isRelevant(String queryid, String docno)
queryid
- String a query identifier.docno
- String a document identifier.public int getGrade(String qid, String docno, int def)
qid
- String the identifier of the desired query.docno
- String a document identifier.def
- The default value to be returned if the document is not found.Terrier 4.0. Copyright © 2004-2014 University of Glasgow