| #include <vector> |
| #include "ExampleStatefulFF.h" |
| #include "moses/ScoreComponentCollection.h" |
| #include "moses/Hypothesis.h" |
|
|
| using namespace std; |
|
|
| namespace Moses |
| { |
|
|
| |
| ExampleStatefulFF::ExampleStatefulFF(const std::string &line) |
| :StatefulFeatureFunction(3, line) |
| { |
| ReadParameters(); |
| } |
|
|
|
|
| |
| |
| |
| void ExampleStatefulFF::EvaluateInIsolation(const Phrase &source |
| , const TargetPhrase &targetPhrase |
| , ScoreComponentCollection &scoreBreakdown |
| , ScoreComponentCollection &estimatedScores) const |
| {} |
|
|
| |
| |
| |
| void ExampleStatefulFF::EvaluateWithSourceContext(const InputType &input |
| , const InputPath &inputPath |
| , const TargetPhrase &targetPhrase |
| , const StackVec *stackVec |
| , ScoreComponentCollection &scoreBreakdown |
| , ScoreComponentCollection *estimatedScores) const |
| {} |
|
|
| |
| |
| |
| void ExampleStatefulFF::EvaluateTranslationOptionListWithSourceContext |
| (const InputType &input, const TranslationOptionList &translationOptionList) const |
| {} |
|
|
| FFState* ExampleStatefulFF::EvaluateWhenApplied( |
| const Hypothesis& cur_hypo, |
| const FFState* prev_state, |
| ScoreComponentCollection* accumulator) const |
| { |
| |
| vector<float> newScores(m_numScoreComponents); |
| newScores[0] = 1.5; |
| newScores[1] = 0.3; |
| newScores[2] = 0.4; |
| accumulator->PlusEquals(this, newScores); |
|
|
| |
| accumulator->PlusEquals(this, "sparse-name", 2.4); |
|
|
| |
| return new ExampleState(0); |
| } |
|
|
| FFState* ExampleStatefulFF::EvaluateWhenApplied( |
| const ChartHypothesis& , |
| int , |
| ScoreComponentCollection* accumulator) const |
| { |
| return new ExampleState(0); |
| } |
|
|
| void ExampleStatefulFF::SetParameter(const std::string& key, const std::string& value) |
| { |
| if (key == "arg") { |
| |
| } else { |
| StatefulFeatureFunction::SetParameter(key, value); |
| } |
| } |
|
|
| } |
|
|
|
|