00001 /*========================================================================== 00002 * Copyright (c) 2004 Carnegie Mellon University. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 // tnt - 6/2004 00013 00014 #ifndef _STRINGQUERY_HPP 00015 #define _STRINGQUERY_HPP 00016 00017 #include "TermQuery.hpp" 00018 #include "TextHandler.hpp" 00019 #include "common_headers.hpp" 00020 00026 00027 class StringQuery: public TermQuery, public TextHandler { 00028 public: 00029 StringQuery(); 00030 StringQuery(const char* query, const char* qid=NULL); 00031 StringQuery(const string& query, const string& qid=""); 00032 ~StringQuery(); 00033 00035 void startTermIteration() const{iter = 0;} 00036 bool hasMore() const{ return iter < tokens.size();} 00037 const Term* nextTerm() const; 00038 00039 void addTerm(const string& token); 00040 void addTerm(const char* token); 00041 void parse(const string& token); 00042 00044 char* handleWord(char* word); 00045 char* handleSymbol(char* sym); 00046 00047 protected: 00048 vector<string> tokens; 00049 mutable int iter; 00050 mutable Term tt; 00051 }; 00052 00053 00054 #endif