public class TRECQuery extends Object implements QuerySource
Properties:
Modifier and Type | Field and Description |
---|---|
protected static String |
desiredEncoding
Encoding to be used to open all files.
|
protected static boolean |
IGNORE_DESC_NARR_NAME_TOKENS
Value of trecquery.ignore.desc.narr.name.tokens - should the token DESCRIPTION and NARRATIVE in the desc and narr fields be ignored? Defaluts to true?
|
protected int |
index
The index of the queries.
|
protected static org.apache.log4j.Logger |
logger
The logger used for this class
|
protected String[] |
queries
The queries in the topic files.
|
protected String[] |
query_ids
The query identifiers in the topic files.
|
protected String[] |
topicFiles
The topic files used in this object
|
Constructor and Description |
---|
TRECQuery()
Constructs an instance of TRECQuery,
that reads and stores all the queries from
the files defined in the trec.topics property.
|
TRECQuery(File queryfile)
Constructs an instance of TRECQuery that
reads and stores all the queries from a
the specified query file.
|
TRECQuery(File[] queryfiles)
Constructs an instance of TRECQuery that
reads and stores all the queries from
the specified query files.
|
TRECQuery(String queryfilename)
Constructs an instance of TRECQuery that
reads and stores all the queries from a
file with the specified filename.
|
TRECQuery(String[] queryfilenames)
Constructs an instance of TRECQuery that
reads and stores all the queries from
files with the specified filename.
|
Modifier and Type | Method and Description |
---|---|
boolean |
extractQuery(String[] queryfilenames,
Vector<String> vecStringQueries,
Vector<String> vecStringIds)
Extracts and stores all the queries from query files.
|
boolean |
extractQuery(String queryfilename,
Vector<String> vecStringQueries,
Vector<String> vecStringIds)
Extracts and stores all the queries from a query file.
|
int |
getIndexOfCurrentQuery()
Returns the index of the last obtained query.
|
String[] |
getInfo()
Returns the filenames of the topic files from which the queries were extracted
|
int |
getNumberOfQueries()
Returns the number of the queries read from the
processed topic files.
|
String |
getQuery(String queryNo)
Return the query for the given query number.
|
String |
getQueryId()
Returns the query identifier of the last query
fetched, or the first one, if none has been
fetched yet.
|
String[] |
getQueryIds()
Returns the query ids
|
String[] |
getTopicFilenames()
Deprecated.
|
boolean |
hasMoreQueries()
Deprecated.
|
boolean |
hasNext() |
static void |
main(String[] args)
main
|
String |
next() |
String |
nextQuery()
Deprecated.
|
void |
remove() |
void |
reset()
Resets the query source back to the first query.
|
String[] |
toArray()
Returns the queries in an array of strings
|
protected static final org.apache.log4j.Logger logger
protected static final boolean IGNORE_DESC_NARR_NAME_TOKENS
protected static String desiredEncoding
protected String[] topicFiles
protected String[] queries
protected String[] query_ids
protected int index
public TRECQuery()
public TRECQuery(File queryfile)
queryfile
- File the file containing the queries.public TRECQuery(File[] queryfiles)
queryfiles
- File the file containing the queries.public TRECQuery(String queryfilename)
queryfilename
- String the name of the file containing
all the queries.public TRECQuery(String[] queryfilenames)
queryfilenames
- String[] the name of the files containing
all the queries.public boolean extractQuery(String[] queryfilenames, Vector<String> vecStringQueries, Vector<String> vecStringIds)
queryfilenames
- String the name of files containing topics.vecStringQueries
- Vector a vector containing the
queries as strings.vecStringIds
- Vector a vector containing the query
identifiers as strings.public boolean extractQuery(String queryfilename, Vector<String> vecStringQueries, Vector<String> vecStringIds)
queryfilename
- String the name of a file containing topics.vecStringQueries
- Vector a vector containing the
queries as strings.vecStringIds
- Vector a vector containing the query
identifiers as strings.public int getIndexOfCurrentQuery()
public int getNumberOfQueries()
public String[] getInfo()
getInfo
in interface QuerySource
public String[] getTopicFilenames()
public String getQuery(String queryNo)
queryNo
- String The number of a query.public boolean hasMoreQueries()
public String nextQuery()
public String getQueryId()
getQueryId
in interface QuerySource
public String[] getQueryIds()
public String[] toArray()
public void reset()
reset
in interface QuerySource
public static void main(String[] args)
args
- Terrier 4.0. Copyright © 2004-2014 University of Glasgow