|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.terrier.structures.TRECQuery
public class TRECQuery
This class is used for reading the queries from TREC topic files.
Properties:
Field Summary | |
---|---|
protected static java.lang.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 java.lang.String[] |
queries
The queries in the topic files. |
protected java.lang.String[] |
query_ids
The query identifiers in the topic files. |
protected java.lang.String[] |
topicFiles
The topic files used in this object |
Constructor Summary | |
---|---|
TRECQuery()
Constructs an instance of TRECQuery, that reads and stores all the queries from the files defined in the trec.topics property. |
|
TRECQuery(java.io.File queryfile)
Constructs an instance of TRECQuery that reads and stores all the queries from a the specified query file. |
|
TRECQuery(java.io.File[] queryfiles)
Constructs an instance of TRECQuery that reads and stores all the queries from the specified query files. |
|
TRECQuery(java.lang.String queryfilename)
Constructs an instance of TRECQuery that reads and stores all the queries from a file with the specified filename. |
|
TRECQuery(java.lang.String[] queryfilenames)
Constructs an instance of TRECQuery that reads and stores all the queries from files with the specified filename. |
Method Summary | |
---|---|
boolean |
extractQuery(java.lang.String[] queryfilenames,
java.util.Vector<java.lang.String> vecStringQueries,
java.util.Vector<java.lang.String> vecStringIds)
Extracts and stores all the queries from query files. |
boolean |
extractQuery(java.lang.String queryfilename,
java.util.Vector<java.lang.String> vecStringQueries,
java.util.Vector<java.lang.String> vecStringIds)
Extracts and stores all the queries from a query file. |
int |
getIndexOfCurrentQuery()
Returns the index of the last obtained query. |
java.lang.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. |
java.lang.String |
getQuery(java.lang.String queryNo)
Return the query for the given query number. |
java.lang.String |
getQueryId()
Returns the query identifier of the last query fetched, or the first one, if none has been fetched yet. |
java.lang.String[] |
getQueryIds()
Returns the query ids |
java.lang.String[] |
getTopicFilenames()
Deprecated. |
boolean |
hasMoreQueries()
Deprecated. |
boolean |
hasNext()
|
static void |
main(java.lang.String[] args)
main |
java.lang.String |
next()
|
java.lang.String |
nextQuery()
Deprecated. |
void |
remove()
|
void |
reset()
Resets the query source back to the first query. |
java.lang.String[] |
toArray()
Returns the queries in an array of strings |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger logger
protected static final boolean IGNORE_DESC_NARR_NAME_TOKENS
protected static java.lang.String desiredEncoding
protected java.lang.String[] topicFiles
protected java.lang.String[] queries
protected java.lang.String[] query_ids
protected int index
Constructor Detail |
---|
public TRECQuery()
public TRECQuery(java.io.File queryfile)
queryfile
- File the file containing the queries.public TRECQuery(java.io.File[] queryfiles)
queryfiles
- File the file containing the queries.public TRECQuery(java.lang.String queryfilename)
queryfilename
- String the name of the file containing
all the queries.public TRECQuery(java.lang.String[] queryfilenames)
queryfilenames
- String[] the name of the files containing
all the queries.Method Detail |
---|
public boolean extractQuery(java.lang.String[] queryfilenames, java.util.Vector<java.lang.String> vecStringQueries, java.util.Vector<java.lang.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(java.lang.String queryfilename, java.util.Vector<java.lang.String> vecStringQueries, java.util.Vector<java.lang.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 java.lang.String[] getInfo()
getInfo
in interface TRECQuerying.QuerySource
public java.lang.String[] getTopicFilenames()
public java.lang.String getQuery(java.lang.String queryNo)
queryNo
- String The number of a query.
public boolean hasMoreQueries()
public boolean hasNext()
hasNext
in interface java.util.Iterator<java.lang.String>
public java.lang.String nextQuery()
public java.lang.String next()
next
in interface java.util.Iterator<java.lang.String>
public java.lang.String getQueryId()
getQueryId
in interface TRECQuerying.QuerySource
public java.lang.String[] getQueryIds()
public java.lang.String[] toArray()
public void reset()
reset
in interface TRECQuerying.QuerySource
public void remove()
remove
in interface java.util.Iterator<java.lang.String>
public static void main(java.lang.String[] args)
args
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |