mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
40 lines
805 B
C++
40 lines
805 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)
|
|
{
|
|
description_counts.insert(description);
|
|
size_t count = description_counts.count(description);
|
|
ostringstream dstream;
|
|
dstream << description;
|
|
if (count > 1)
|
|
{
|
|
dstream << ":" << count;
|
|
}
|
|
m_description = dstream.str();
|
|
if (numScoreComponents != unlimited)
|
|
{
|
|
ScoreComponentCollection::RegisterScoreProducer(this);
|
|
}
|
|
}
|
|
|
|
ScoreProducer::~ScoreProducer() {
|
|
}
|
|
|
|
}
|
|
|