mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
Avoid bad_alloc for variable length features
git-svn-id: http://svn.statmt.org/repository/mira@3837 cc96ff50-19ce-11e0-b349-13d7f0bd23df
This commit is contained in:
parent
b7971689cb
commit
14b35072bc
@ -200,7 +200,9 @@ public:
|
||||
//! return a vector of all the scores associated with a certain ScoreProducer
|
||||
std::vector<float> GetScoresForProducer(const ScoreProducer* sp) const
|
||||
{
|
||||
std::vector<float> res(sp->GetNumScoreComponents());
|
||||
size_t components = sp->GetNumScoreComponents();
|
||||
if (components == ScoreProducer::unlimited) return std::vector<float>();
|
||||
std::vector<float> res(components);
|
||||
const std::vector<FName>& names = sp->GetFeatureNames();
|
||||
for (size_t i = 0; i < names.size(); ++i) {
|
||||
res[i] = m_scores[names[i]];
|
||||
|
Loading…
Reference in New Issue
Block a user