concordia-library/concordia/index_searcher.hpp

47 lines
1002 B
C++

#ifndef INDEX_SEARCHER_HDR
#define INDEX_SEARCHER_HDR
#include <boost/shared_ptr.hpp>
#include <fstream>
#include <iostream>
#include "concordia/common/config.hpp"
#include "build/libdivsufsort/include/divsufsort.h"
#include "concordia/hash_generator.hpp"
#include "concordia/concordia_exception.hpp"
/*!
Class for searching the index with a sentence.
*/
using namespace std;
class IndexSearcher {
public:
explicit IndexSearcher();
/*! Destructor.
*/
virtual ~IndexSearcher();
void loadIndex(const string & wordMapFilepath,
const string & hashedIndexFilepath,
const string & suffixArrayFilepath)
throw(ConcordiaException);
vector<saidx_t> simpleSearch(const string & pattern)
throw(ConcordiaException);
private:
boost::shared_ptr<HashGenerator> _hashGenerator;
sauchar_t * _T;
saidx_t * _SA;
saidx_t _n;
};
#endif