28 _list.push_back (iString);
43 std::ostringstream oStr;
50 std::ostringstream oStr;
56 short idx_sublist = 0;
57 for (StringList_T::const_iterator itWordCombination =
_list.begin();
58 itWordCombination !=
_list.end(); ++itWordCombination, ++idx_sublist) {
60 if (idx_sublist != 0) {
65 const StringSet& lStringSet = *itWordCombination;
87 void WordCombinationHolder::init (
const std::string& iPhrase) {
89 typedef std::set<std::string> StringSet_T;
90 StringSet_T lStringSet;
95 lStringPartitionHolder._partition;
99 for (StringPartition::StringPartition_T::const_iterator itSet =
100 lStringPartition.begin(); itSet != lStringPartition.end(); ++itSet) {
104 for (StringList_T::const_iterator itWordCombination = lStringList.begin();
105 itWordCombination != lStringList.end(); ++itWordCombination) {
106 const std::string& lWordCombination = *itWordCombination;
110 const bool isToBeAdded =
true;
111 if (isToBeAdded ==
true) {
112 lStringSet.insert (lWordCombination);
118 for (StringSet_T::const_iterator itWordCombination = lStringSet.begin();
119 itWordCombination != lStringSet.end(); ++itWordCombination) {
120 const std::string& lWordCombination = *itWordCombination;
125 _list.push_back (lWordCombination);
135 const short nbOfWords = lWordList.size();
138 if (nbOfWords <= 2) {
144 for (
short mdl_string_len = 1; mdl_string_len != nbOfWords-1;
149 for (
short idx_word=1; idx_word != nbOfWords-mdl_string_len; ++idx_word) {
151 const std::string& lLeftHandString =
155 const std::string& lRightHandString =
157 idx_word + mdl_string_len,
161 std::ostringstream lConcatenatedStr;
162 lConcatenatedStr << lLeftHandString <<
" " << lRightHandString;
163 const std::string& lConcatenatedString = lConcatenatedStr.str();
168 const bool isToBeAdded =
true;
169 if (isToBeAdded ==
true) {
170 _list.push_back (lConcatenatedString);
std::vector< std::string > WordList_T
void fromStream(std::istream &)
std::string createStringFromWordList(const WordList_T &iWordList, const unsigned short iSplitIdx, const bool iFromBeginningFlag)
std::string describeKey() const
std::list< StringSet > StringPartition_T
void push_back(const std::string &)
std::string describe() const
WordCombinationHolder(const std::string &)
std::list< std::string > StringList_T
void tokeniseStringIntoWordList(const std::string &iPhrase, WordList_T &ioWordList)
Class holding a set of strings, e.g., {"rio", "de", "janeiro"}.
void toStream(std::ostream &) const