concordia-library/concordia/concordia_config.hpp

86 lines
2.1 KiB
C++

#ifndef CONCORDIA_CONFIG_HDR
#define CONCORDIA_CONFIG_HDR
#include <string>
#include <list>
#include <libconfig.h++>
#include "concordia/concordia_exception.hpp"
/*!
Class representing the Concordia configuration.
*/
class ConcordiaConfig {
public:
/*!
Constructor.
\param configFilePath path of the configuration file (see \ref running3 for file specification).
\throws ConcordiaException
*/
explicit ConcordiaConfig(const std::string & configFilePath);
/*! Destructor.
*/
virtual ~ConcordiaConfig();
/*! Getter for html tags file path.
For more information see \ref tutorial3.
\returns html tags file path
*/
std::string & getHtmlTagsFilePath() {
return _htmlTagsFilePath;
}
/*! Getter for stop symbols enabled parameter.
For more information see \ref tutorial3.
\returns true if stop words are enabled
*/
bool & isStopWordsEnabled() {
return _stopWordsEnabled;
}
/*! Getter for stop words file path.
For more information see \ref tutorial3.
\returns stop words file path
*/
std::string & getStopWordsFilePath() {
return _stopWordsFilePath;
}
/*! Getter for named entities file path.
For more information see \ref tutorial3.
\returns named entities file path
*/
std::string & getNamedEntitiesFilePath() {
return _namedEntitiesFilePath;
}
/*! Getter for anubis threshold. Anubis search results with
scores below that threshold will be discarded.
\returns anubis threshold
*/
double getAnubisThreshold() {
return _anubisThreshold;
}
private:
libconfig::Config _config;
std::string _htmlTagsFilePath;
bool _stopWordsEnabled;
std::string _stopWordsFilePath;
std::string _namedEntitiesFilePath;
double _anubisThreshold;
std::string _readConfigParameterStr(const std::string & name);
std::string _readConfigParameterStr(const std::string & name,
const std::string & defaultValue);
};
#endif