std::string Word::GetString(const FactorList &factorTypes) const { assert(factorTypes.size()); std::stringstream ret; ret << m_factors[factorTypes[0]]->GetString(); for (size_t i = 1; i < factorTypes.size(); ++i) { FactorType factorType = factorTypes[i]; ret << "|" << m_factors[factorType]; } return ret.str(); }
void PhraseBoundaryFeature::AddFeatures( const Word* leftWord, const Word* rightWord, const FactorList& factors, const string& side, ScoreComponentCollection* scores) const { for (size_t i = 0; i < factors.size(); ++i) { ostringstream name; name << side << ":"; name << factors[i]; name << ":"; if (leftWord) { name << leftWord->GetFactor(factors[i])->GetString(); } else { name << BOS_; } name << ":"; if (rightWord) { name << rightWord->GetFactor(factors[i])->GetString(); } else { name << EOS_; } scores->PlusEquals(this,name.str(),1); } }