2013-05-25 03:57:37 +04:00
|
|
|
#include "WordPenaltyProducer.h"
|
|
|
|
#include "moses/TargetPhrase.h"
|
|
|
|
#include "moses/ScoreComponentCollection.h"
|
|
|
|
|
2013-06-20 15:50:41 +04:00
|
|
|
using namespace std;
|
|
|
|
|
2013-05-25 03:57:37 +04:00
|
|
|
namespace Moses
|
|
|
|
{
|
2013-06-20 15:50:41 +04:00
|
|
|
WordPenaltyProducer::WordPenaltyProducer(const std::string &line)
|
2013-06-26 20:19:09 +04:00
|
|
|
: StatelessFeatureFunction("WordPenalty",1, line)
|
|
|
|
{
|
2013-06-20 16:06:03 +04:00
|
|
|
ReadParameters();
|
2013-06-20 15:50:41 +04:00
|
|
|
}
|
|
|
|
|
2013-05-28 13:51:28 +04:00
|
|
|
void WordPenaltyProducer::Evaluate(const Phrase &source
|
2013-05-29 21:16:15 +04:00
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection &estimatedFutureScore) const
|
2013-05-25 03:57:37 +04:00
|
|
|
{
|
|
|
|
float score = - (float) targetPhrase.GetNumTerminals();
|
|
|
|
scoreBreakdown.Assign(this, score);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|