2008-06-11 14:52:57 +04:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
#include <iostream>
|
2010-10-07 02:06:49 +04:00
|
|
|
#include <sstream>
|
|
|
|
|
2011-11-09 21:16:02 +04:00
|
|
|
#include "ScoreComponentCollection.h"
|
2008-06-11 14:52:57 +04:00
|
|
|
#include "ScoreProducer.h"
|
2010-10-07 02:06:49 +04:00
|
|
|
|
|
|
|
using namespace std;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
namespace Moses
|
|
|
|
{
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2010-10-11 18:09:39 +04:00
|
|
|
multiset<string> ScoreProducer::description_counts;
|
2010-10-15 01:52:35 +04:00
|
|
|
const size_t ScoreProducer::unlimited = -1;
|
2010-10-11 18:09:39 +04:00
|
|
|
|
2011-11-09 01:22:34 +04:00
|
|
|
ScoreProducer::ScoreProducer(const std::string& description, size_t numScoreComponents)
|
|
|
|
: m_reportSparseFeatures(false), m_numScoreComponents(numScoreComponents)
|
2010-10-11 18:09:39 +04:00
|
|
|
{
|
2012-12-10 20:00:05 +04:00
|
|
|
size_t index = description_counts.count(description);
|
|
|
|
|
2010-10-11 18:09:39 +04:00
|
|
|
ostringstream dstream;
|
|
|
|
dstream << description;
|
2012-12-12 16:22:13 +04:00
|
|
|
dstream << index;
|
2012-12-07 22:13:37 +04:00
|
|
|
|
2012-12-10 20:00:05 +04:00
|
|
|
description_counts.insert(description);
|
2012-12-07 22:13:37 +04:00
|
|
|
|
2010-10-11 18:09:39 +04:00
|
|
|
m_description = dstream.str();
|
2011-11-09 21:16:02 +04:00
|
|
|
if (numScoreComponents != unlimited)
|
|
|
|
{
|
|
|
|
ScoreComponentCollection::RegisterScoreProducer(this);
|
|
|
|
}
|
2010-10-11 18:09:39 +04:00
|
|
|
}
|
|
|
|
|
2012-12-31 04:57:21 +04:00
|
|
|
ScoreProducer::~ScoreProducer()
|
|
|
|
{
|
|
|
|
cerr << endl << "In ~ScoreProducer of" << this << endl;
|
2011-11-16 15:49:31 +04:00
|
|
|
}
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
}
|
|
|
|
|
2012-12-31 04:57:21 +04:00
|
|
|
|