21 Filter::Filter (
const Filter& iFilter) {
40 bool hasGoodSizeFlag =
true;
42 const size_t lWordLength = iWord.size();
43 if (lWordLength < iMinWordLength) {
44 hasGoodSizeFlag =
false;
46 return hasGoodSizeFlag;
56 BlackList_T::const_iterator itWord =
K_BLACK_LIST.find (iWord);
57 const bool isBlackListedFlag = (itWord !=
K_BLACK_LIST.end());
65 return isBlackListedFlag;
74 if (ioWordList.empty() ==
true) {
79 WordList_T::reverse_iterator itWord = ioWordList.rbegin();
80 assert (itWord != ioWordList.rend());
81 const std::string& lWord = *itWord;
85 const bool hasGoodSizeFlag =
hasGoodSize (lWord, iMinWordLength);
87 if (hasGoodSizeFlag ==
false || isBlackListedFlag ==
true) {
88 ioWordList.erase (--itWord.base());
89 rtrim (ioWordList, iMinWordLength);
99 if (ioWordList.empty() ==
true) {
104 WordList_T::iterator itWord = ioWordList.begin();
105 assert (itWord != ioWordList.end());
106 const std::string& lWord = *itWord;
110 const bool hasGoodSizeFlag =
hasGoodSize (lWord, iMinWordLength);
112 if (hasGoodSizeFlag ==
false || isBlackListedFlag ==
true) {
113 ioWordList.erase (itWord);
114 ltrim (ioWordList, iMinWordLength);
124 ltrim (ioWordList, iMinWordLength);
127 rtrim (ioWordList, iMinWordLength);
145 const std::string& iWord) {
146 bool isToBeKept =
true;
150 if (iPhrase.empty() ==
true && iWord.empty() ==
true) {
159 if (iPhrase == iWord) {
170 if (isToBeKept ==
false) {
void ltrim(WordList_T &ioWordList, const NbOfLetters_T &iMinWordLength)
bool isBlackListed(const std::string &iWord)
void trim(WordList_T &ioWordList, const NbOfLetters_T &iMinWordLength)
std::string createStringFromWordList(const WordList_T &iWordList, const unsigned short iSplitIdx, const bool iFromBeginningFlag)
unsigned int NbOfLetters_T
void rtrim(WordList_T &ioWordList, const NbOfLetters_T &iMinWordLength)
static void trim(std::string &ioPhrase, const NbOfLetters_T &iMinWordLength=4)
std::list< Word_T > WordList_T
bool hasGoodSize(const std::string &iWord, const NbOfLetters_T &iMinWordLength)
static bool shouldKeep(const std::string &iPhrase, const std::string &iWord)
const BlackList_T K_BLACK_LIST
void tokeniseStringIntoWordList(const std::string &iPhrase, WordList_T &ioWordList)