18 : _initialString (iString) {
28 if (iStringSet.
empty() ==
false) {
50 std::ostringstream oStr;
57 std::ostringstream oStr;
63 short idx_sublist = 0;
64 for (StringPartition_T::const_iterator itSet =
_partition.begin();
65 itSet !=
_partition.end(); ++itSet, ++idx_sublist) {
67 if (idx_sublist != 0) {
94 void StringPartition::init (
const std::string& iPhrase) {
99 const short nbOfWords = lWordList.size();
109 if (nbOfWords <= 1) {
115 for (
short idx_word = 1; idx_word != nbOfWords; ++idx_word) {
142 for (StringPartition_T::const_iterator itSet= lStringRHSPartition.begin();
143 itSet != lStringRHSPartition.end(); ++itSet) {
144 const StringSet& lRHSStringSet = *itSet;
150 StringSet lNewStringSet;
153 lNewStringSet.push_back (lLeftHandString);
156 lNewStringSet.push_back (lRHSStringSet);
179 for (StringPartition_T::const_iterator itSet =
_partition.begin();
184 for (StringSet::StringSet_T::const_iterator itString = lStringSet.begin();
185 itString != lStringSet.end(); ++itString) {
186 const std::string& lWordCombination = *itString;
189 WordSet_T::const_iterator itExistingString = lStringList.find (lWordCombination);
190 if (itExistingString == lStringList.end()) {
192 lStringList.insert (lWordCombination);
198 for (WordSet_T::const_iterator itString = lStringList.begin();
199 itString != lStringList.end(); ++itString) {
200 const std::string& lWordCombination = *itString;
std::string createStringFromWordList(const WordList_T &iWordList, const unsigned short iSplitIdx, const bool iFromBeginningFlag)
std::list< StringSet > StringPartition_T
void toStream(std::ostream &ioOut) const
std::list< Word_T > WordList_T
std::set< std::string > WordSet_T
std::string describe() const
void tokeniseStringIntoWordList(const std::string &iPhrase, WordList_T &ioWordList)
StringPartition_T _partition
void push_back(const StringSet &iStringSet)
std::string describeKey() const
Class holding a set of strings, e.g., {"rio", "de", "janeiro"}.
StringSet calculateUniqueCombinations() const
void fromStream(std::istream &ioIn)
StringPartition(const std::string &iStringToBePartitioned)
void push_back(const std::string &)
std::list< std::string > StringSet_T