concordia-library/concordia/sentence_anonymizer.hpp
rjawor 3a03b01f42 std vectors
Former-commit-id: 5816e87c856f7edc242cc707851a0e2ad05aeb38
2015-04-15 10:55:26 +02:00

54 lines
1.4 KiB
C++

#ifndef SENTENCE_ANONYMIZER_HDR
#define SENTENCE_ANONYMIZER_HDR
#include <string>
#include <vector>
#include "concordia/common/config.hpp"
#include "concordia/regex_replacement.hpp"
#include "concordia/concordia_config.hpp"
#include "concordia/concordia_exception.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/filesystem.hpp>
/*!
Class for anonymizing sentence before adding to index.
*/
using namespace std;
class SentenceAnonymizer {
public:
explicit SentenceAnonymizer(boost::shared_ptr<ConcordiaConfig> config)
throw(ConcordiaException);
/*! Destructor.
*/
virtual ~SentenceAnonymizer();
string anonymize(const string & sentence);
private:
void _createNeRules(string & namedEntitiesPath);
void _createHtmlTagsRule(string & htmlTagsPath);
boost::shared_ptr<RegexReplacement> _getMultipleReplacementRule(
string & filePath,
string replacement,
bool wholeWord = false);
vector<RegexReplacement> _namedEntities;
boost::shared_ptr<RegexReplacement> _htmlTags;
boost::shared_ptr<RegexReplacement> _stopWords;
boost::shared_ptr<RegexReplacement> _stopSymbols;
boost::shared_ptr<RegexReplacement> _spaceSymbols;
};
#endif