LTR_Text::LTR_Text(const LTR_Text& text): std::vector<LTR_Token*>() { this->reserve(text.size()); for (LTR_Text::const_iterator itTok = text.begin(); itTok != text.end(); ++ itTok) { this->push_back(new LTR_Token(**itTok)); } for (SENTENCE_BOUNDS_T::const_iterator itSentBd = text.m_sentenceBounds.begin(); itSentBd != text.m_sentenceBounds.end(); ++ itSentBd) { m_sentenceBounds.push_back(*itSentBd); } }
void LTR_Text::appendLTR_Text(const LTR_Text& ltr) { LTR_Text::size_type thiSize = this->size(); // copy of tokens this->reserve(thiSize + ltr.size()); for (LTR_Text::const_iterator itTok = ltr.begin(); itTok != ltr.end(); ++ itTok) { LTR_Token* tok = new LTR_Token(**itTok); this->push_back(tok); } // add sentence bounds for (LTR_Text::SENTS_CONST_ITER_T itSentBd = ltr.beginSentenceBounds(); itSentBd != ltr.endSentenceBounds(); ++ itSentBd) { m_sentenceBounds.push_back(*itSentBd + thiSize); } }