mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-28 14:32:38 +03:00
40 lines
773 B
C++
40 lines
773 B
C++
// $Id$
|
|
|
|
#include <iostream>
|
|
#include <sstream>
|
|
|
|
#include "ScoreComponentCollection.h"
|
|
#include "ScoreProducer.h"
|
|
|
|
using namespace std;
|
|
|
|
namespace Moses
|
|
{
|
|
|
|
multiset<string> ScoreProducer::description_counts;
|
|
const size_t ScoreProducer::unlimited = -1;
|
|
|
|
ScoreProducer::ScoreProducer(const std::string& description, size_t numScoreComponents)
|
|
: m_reportSparseFeatures(false), m_numScoreComponents(numScoreComponents)
|
|
{
|
|
size_t index = description_counts.count(description);
|
|
|
|
ostringstream dstream;
|
|
dstream << description;
|
|
dstream << index;
|
|
|
|
description_counts.insert(description);
|
|
|
|
m_description = dstream.str();
|
|
if (numScoreComponents != unlimited)
|
|
{
|
|
ScoreComponentCollection::RegisterScoreProducer(this);
|
|
}
|
|
}
|
|
|
|
ScoreProducer::~ScoreProducer() {
|
|
}
|
|
|
|
}
|
|
|