2015-01-06 16:07:12 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "StatelessFeatureFunction.h"
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
2017-04-26 15:16:58 +03:00
|
|
|
class ExampleTranslationOptionListFeature : public StatelessFeatureFunction
|
2015-01-06 16:07:12 +03:00
|
|
|
{
|
|
|
|
public:
|
2017-04-26 15:16:58 +03:00
|
|
|
ExampleTranslationOptionListFeature(const std::string &line)
|
2015-01-14 14:07:42 +03:00
|
|
|
:StatelessFeatureFunction(1, line) {
|
2015-01-06 16:07:12 +03:00
|
|
|
ReadParameters();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsUseable(const FactorMask &mask) const {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EvaluateInIsolation(const Phrase &source
|
2015-01-14 14:07:42 +03:00
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection &estimatedFutureScore) const {
|
|
|
|
}
|
|
|
|
|
2015-01-06 16:07:12 +03:00
|
|
|
void EvaluateWithSourceContext(const InputType &input
|
2015-01-14 14:07:42 +03:00
|
|
|
, const InputPath &inputPath
|
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, const StackVec *stackVec
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection *estimatedFutureScore = NULL) const {
|
|
|
|
}
|
2015-01-06 16:07:12 +03:00
|
|
|
|
|
|
|
void EvaluateTranslationOptionListWithSourceContext(const InputType &input
|
2015-01-14 14:07:42 +03:00
|
|
|
, const TranslationOptionList &translationOptionList) const {
|
2015-08-10 13:03:31 +03:00
|
|
|
std::vector<float> newScores(m_numScoreComponents);
|
2015-01-06 16:07:12 +03:00
|
|
|
newScores[0] = translationOptionList.size();
|
2015-01-14 14:07:42 +03:00
|
|
|
|
2015-01-06 16:07:12 +03:00
|
|
|
TranslationOptionList::const_iterator iterTransOpt;
|
|
|
|
for(iterTransOpt = translationOptionList.begin() ;
|
|
|
|
iterTransOpt != translationOptionList.end() ; ++iterTransOpt) {
|
|
|
|
TranslationOption &transOpt = **iterTransOpt;
|
2015-01-14 14:07:42 +03:00
|
|
|
|
2015-01-06 16:54:40 +03:00
|
|
|
ScoreComponentCollection &scoreBreakDown = transOpt.GetScoreBreakdown();
|
2015-01-06 16:07:12 +03:00
|
|
|
scoreBreakDown.PlusEquals(this, newScores);
|
2015-01-14 14:07:42 +03:00
|
|
|
|
2015-01-06 16:54:40 +03:00
|
|
|
transOpt.UpdateScore();
|
2015-01-06 16:07:12 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EvaluateWhenApplied(const Hypothesis& hypo,
|
2015-01-14 14:07:42 +03:00
|
|
|
ScoreComponentCollection* accumulator) const {
|
|
|
|
}
|
|
|
|
|
2015-01-06 16:07:12 +03:00
|
|
|
void EvaluateWhenApplied(const ChartHypothesis &hypo,
|
2015-01-14 14:07:42 +03:00
|
|
|
ScoreComponentCollection* accumulator) const {
|
|
|
|
}
|
2015-01-06 16:07:12 +03:00
|
|
|
|
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
void SetParameter(const std::string& key, const std::string& value) {
|
|
|
|
}
|
2015-01-06 16:07:12 +03:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|