Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/moses/FF
diff options
context:
space:
mode:
authorUlrich Germann <Ulrich.Germann@gmail.com>2015-11-19 16:54:24 +0300
committerUlrich Germann <Ulrich.Germann@gmail.com>2015-11-19 16:54:24 +0300
commitc610d0a6e74d627801c5603b50a7342c47ad651f (patch)
tree670001874572448f778000cd92c95bd4dcb5b373 /moses/FF
parentedacfbb9fd3830382e3e98b7ece4fd830937e657 (diff)
Code decluttering.
The class StatefuleFeatureFunction now provides an empty dummy implementation of various (virtual) Evaluate... functions. The corresponding empty implementations on derived classes have been removed.
Diffstat (limited to 'moses/FF')
-rw-r--r--moses/FF/BleuScoreFeature.h16
-rw-r--r--moses/FF/ConstrainedDecoding.h18
-rw-r--r--moses/FF/ControlRecombination.h17
-rw-r--r--moses/FF/CoveredReferenceFeature.cpp5
-rw-r--r--moses/FF/CoveredReferenceFeature.h8
-rw-r--r--moses/FF/DistortionScoreProducer.h17
-rw-r--r--moses/FF/LexicalReordering/LexicalReordering.h22
-rw-r--r--moses/FF/OSM-Feature/OpSequenceModel.h12
-rw-r--r--moses/FF/PhraseBoundaryFeature.h17
-rw-r--r--moses/FF/PhraseOrientationFeature.h12
-rw-r--r--moses/FF/SkeletonStatefulFF.cpp14
-rw-r--r--moses/FF/SkeletonStatefulFF.h40
-rw-r--r--moses/FF/StatefulFeatureFunction.h17
-rw-r--r--moses/FF/TargetBigramFeature.h16
-rw-r--r--moses/FF/TargetNgramFeature.h18
-rw-r--r--moses/FF/TreeStructureFeature.h16
16 files changed, 57 insertions, 208 deletions
diff --git a/moses/FF/BleuScoreFeature.h b/moses/FF/BleuScoreFeature.h
index 266d06b68..753d92cf9 100644
--- a/moses/FF/BleuScoreFeature.h
+++ b/moses/FF/BleuScoreFeature.h
@@ -123,22 +123,6 @@ public:
FFState* EvaluateWhenApplied(const ChartHypothesis& cur_hypo,
int featureID,
ScoreComponentCollection* accumulator) const;
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {
- }
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const {
- }
bool Enabled() const {
return m_enabled;
diff --git a/moses/FF/ConstrainedDecoding.h b/moses/FF/ConstrainedDecoding.h
index 3f28c43e1..769edd80f 100644
--- a/moses/FF/ConstrainedDecoding.h
+++ b/moses/FF/ConstrainedDecoding.h
@@ -42,24 +42,6 @@ public:
return true;
}
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const {
- }
-
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {
- }
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
-
FFState* EvaluateWhenApplied(
const Hypothesis& cur_hypo,
const FFState* prev_state,
diff --git a/moses/FF/ControlRecombination.h b/moses/FF/ControlRecombination.h
index 04f7d441b..034b1a790 100644
--- a/moses/FF/ControlRecombination.h
+++ b/moses/FF/ControlRecombination.h
@@ -58,23 +58,6 @@ public:
return true;
}
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const {
- }
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {
- }
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
-
FFState* EvaluateWhenApplied(
const Hypothesis& cur_hypo,
const FFState* prev_state,
diff --git a/moses/FF/CoveredReferenceFeature.cpp b/moses/FF/CoveredReferenceFeature.cpp
index d4606a8ec..5e4ada5b0 100644
--- a/moses/FF/CoveredReferenceFeature.cpp
+++ b/moses/FF/CoveredReferenceFeature.cpp
@@ -30,11 +30,6 @@ bool CoveredReferenceState::operator==(const FFState& other) const
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void CoveredReferenceFeature::EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const
-{}
void CoveredReferenceFeature::EvaluateWithSourceContext(const InputType &input
, const InputPath &inputPath
diff --git a/moses/FF/CoveredReferenceFeature.h b/moses/FF/CoveredReferenceFeature.h
index e6fc79ff7..aedfb3793 100644
--- a/moses/FF/CoveredReferenceFeature.h
+++ b/moses/FF/CoveredReferenceFeature.h
@@ -53,10 +53,6 @@ public:
return new CoveredReferenceState();
}
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const;
void EvaluateWithSourceContext(const InputType &input
, const InputPath &inputPath
, const TargetPhrase &targetPhrase
@@ -64,10 +60,6 @@ public:
, ScoreComponentCollection &scoreBreakdown
, ScoreComponentCollection *estimatedScores = NULL) const;
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
-
FFState* EvaluateWhenApplied(
const Hypothesis& cur_hypo,
const FFState* prev_state,
diff --git a/moses/FF/DistortionScoreProducer.h b/moses/FF/DistortionScoreProducer.h
index 6e6bfbaeb..cfe0dc005 100644
--- a/moses/FF/DistortionScoreProducer.h
+++ b/moses/FF/DistortionScoreProducer.h
@@ -47,23 +47,6 @@ public:
throw std::logic_error("DistortionScoreProducer not supported in chart decoder, yet");
}
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {
- }
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
-
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const {
- }
};
}
diff --git a/moses/FF/LexicalReordering/LexicalReordering.h b/moses/FF/LexicalReordering/LexicalReordering.h
index c47e7f037..fa2747c82 100644
--- a/moses/FF/LexicalReordering/LexicalReordering.h
+++ b/moses/FF/LexicalReordering/LexicalReordering.h
@@ -64,28 +64,6 @@ public:
UTIL_THROW2("LexicalReordering is not valid for chart decoder");
}
- void
- EvaluateWithSourceContext
- (const InputType &input,
- const InputPath &inputPath,
- const TargetPhrase &targetPhrase,
- const StackVec *stackVec,
- ScoreComponentCollection& scoreBreakdown,
- ScoreComponentCollection* estimatedScores = NULL) const
- { }
-
- void
- EvaluateTranslationOptionListWithSourceContext
- (const InputType &input, const TranslationOptionList &transOptList) const
- { }
-
- void
- EvaluateInIsolation(const Phrase &source,
- const TargetPhrase &targetPhrase,
- ScoreComponentCollection &scoreBreakdown,
- ScoreComponentCollection &estimatedScores) const
- { }
-
bool
GetHaveDefaultScores() {
return m_haveDefaultScores;
diff --git a/moses/FF/OSM-Feature/OpSequenceModel.h b/moses/FF/OSM-Feature/OpSequenceModel.h
index b97450d6b..36a901974 100644
--- a/moses/FF/OSM-Feature/OpSequenceModel.h
+++ b/moses/FF/OSM-Feature/OpSequenceModel.h
@@ -37,18 +37,6 @@ public:
int /* featureID - used to index the state in the previous hypotheses */,
ScoreComponentCollection* accumulator) const;
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {
- }
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
-
void EvaluateInIsolation(const Phrase &source
, const TargetPhrase &targetPhrase
, ScoreComponentCollection &scoreBreakdown
diff --git a/moses/FF/PhraseBoundaryFeature.h b/moses/FF/PhraseBoundaryFeature.h
index 916225b7d..9e84aaeef 100644
--- a/moses/FF/PhraseBoundaryFeature.h
+++ b/moses/FF/PhraseBoundaryFeature.h
@@ -54,23 +54,6 @@ public:
throw std::logic_error("PhraseBoundaryState not supported in chart decoder, yet");
}
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {
- }
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const {
- }
-
void SetParameter(const std::string& key, const std::string& value);
private:
diff --git a/moses/FF/PhraseOrientationFeature.h b/moses/FF/PhraseOrientationFeature.h
index 82d3928d9..4d9dc20dc 100644
--- a/moses/FF/PhraseOrientationFeature.h
+++ b/moses/FF/PhraseOrientationFeature.h
@@ -296,18 +296,6 @@ public:
, ScoreComponentCollection &scoreBreakdown
, ScoreComponentCollection &estimatedScores) const;
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const
- {};
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const
- {}
-
FFState* EvaluateWhenApplied(
const Hypothesis& cur_hypo,
const FFState* prev_state,
diff --git a/moses/FF/SkeletonStatefulFF.cpp b/moses/FF/SkeletonStatefulFF.cpp
index 4b077335e..0af74aabd 100644
--- a/moses/FF/SkeletonStatefulFF.cpp
+++ b/moses/FF/SkeletonStatefulFF.cpp
@@ -15,12 +15,19 @@ SkeletonStatefulFF::SkeletonStatefulFF(const std::string &line)
ReadParameters();
}
+
+// An empty implementation of this function is provided by StatefulFeatureFunction.
+// Unless you are actually implementing this, please remove it from your
+// implementation (and the declaration in the header file to reduce code clutter.
void SkeletonStatefulFF::EvaluateInIsolation(const Phrase &source
, const TargetPhrase &targetPhrase
, ScoreComponentCollection &scoreBreakdown
, ScoreComponentCollection &estimatedScores) const
{}
+// An empty implementation of this function is provided by StatefulFeatureFunction.
+// Unless you are actually implementing this, please remove it from your
+// implementation (and the declaration in the header file to reduce code clutter.
void SkeletonStatefulFF::EvaluateWithSourceContext(const InputType &input
, const InputPath &inputPath
, const TargetPhrase &targetPhrase
@@ -29,8 +36,11 @@ void SkeletonStatefulFF::EvaluateWithSourceContext(const InputType &input
, ScoreComponentCollection *estimatedScores) const
{}
-void SkeletonStatefulFF::EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const
+// An empty implementation of this function is provided by StatefulFeatureFunction.
+// Unless you are actually implementing this, please remove it from your
+// implementation (and the declaration in the header file to reduce code clutter.
+void SkeletonStatefulFF::EvaluateTranslationOptionListWithSourceContext
+(const InputType &input, const TranslationOptionList &translationOptionList) const
{}
FFState* SkeletonStatefulFF::EvaluateWhenApplied(
diff --git a/moses/FF/SkeletonStatefulFF.h b/moses/FF/SkeletonStatefulFF.h
index bed54753c..196dcd27c 100644
--- a/moses/FF/SkeletonStatefulFF.h
+++ b/moses/FF/SkeletonStatefulFF.h
@@ -37,19 +37,35 @@ public:
return new SkeletonState(0);
}
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const;
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const;
+ // An empty implementation of this function is provided by StatefulFeatureFunction.
+ // Unless you are actually implementing this, please remove this declaration here
+ // and the empty skeleton implementation from the corresponding .cpp
+ // file to reduce code clutter.
+ void
+ EvaluateInIsolation(const Phrase &source
+ , const TargetPhrase &targetPhrase
+ , ScoreComponentCollection &scoreBreakdown
+ , ScoreComponentCollection &estimatedScores) const;
+
+ // An empty implementation of this function is provided by StatefulFeatureFunction.
+ // Unless you are actually implementing this, please remove this declaration here
+ // and the empty skeleton implementation from the corresponding .cpp
+ // file to reduce code clutter.
+ void
+ EvaluateWithSourceContext(const InputType &input
+ , const InputPath &inputPath
+ , const TargetPhrase &targetPhrase
+ , const StackVec *stackVec
+ , ScoreComponentCollection &scoreBreakdown
+ , ScoreComponentCollection *estimatedScores = NULL) const;
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const;
+ // An empty implementation of this function is provided by StatefulFeatureFunction.
+ // Unless you are actually implementing this, please remove this declaration here
+ // and the empty skeleton implementation from the corresponding .cpp
+ // file to reduce code clutter.
+ void
+ EvaluateTranslationOptionListWithSourceContext
+ ( const InputType &input , const TranslationOptionList &translationOptionList) const;
FFState* EvaluateWhenApplied(
const Hypothesis& cur_hypo,
diff --git a/moses/FF/StatefulFeatureFunction.h b/moses/FF/StatefulFeatureFunction.h
index 814818f63..3f4e6f85e 100644
--- a/moses/FF/StatefulFeatureFunction.h
+++ b/moses/FF/StatefulFeatureFunction.h
@@ -66,6 +66,23 @@ public:
return false;
}
+
+ virtual void
+ EvaluateInIsolation
+ (Phrase const& source, TargetPhrase const& targetPhrase,
+ ScoreComponentCollection &scoreBreakdown,
+ ScoreComponentCollection &estimatedScores) const {}
+
+ virtual void
+ EvaluateWithSourceContext
+ (InputType const&input, InputPath const& inputPath, TargetPhrase const& targetPhrase,
+ StackVec const* stackVec, ScoreComponentCollection &scoreBreakdown,
+ ScoreComponentCollection *estimatedFutureScore = NULL) const {}
+
+ virtual void
+ EvaluateTranslationOptionListWithSourceContext
+ (const InputType &input, const TranslationOptionList &translationOptionList) const {}
+
};
diff --git a/moses/FF/TargetBigramFeature.h b/moses/FF/TargetBigramFeature.h
index 200eca060..eacd27656 100644
--- a/moses/FF/TargetBigramFeature.h
+++ b/moses/FF/TargetBigramFeature.h
@@ -48,22 +48,6 @@ public:
ScoreComponentCollection* ) const {
throw std::logic_error("TargetBigramFeature not valid in chart decoder");
}
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {
- }
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const {
- }
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
void SetParameter(const std::string& key, const std::string& value);
diff --git a/moses/FF/TargetNgramFeature.h b/moses/FF/TargetNgramFeature.h
index 5bc2fc953..0a4b4aa25 100644
--- a/moses/FF/TargetNgramFeature.h
+++ b/moses/FF/TargetNgramFeature.h
@@ -215,24 +215,6 @@ public:
virtual FFState* EvaluateWhenApplied(const ChartHypothesis& cur_hypo, int featureId,
ScoreComponentCollection* accumulator) const;
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {
- }
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
-
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const {
- }
-
void SetParameter(const std::string& key, const std::string& value);
private:
diff --git a/moses/FF/TreeStructureFeature.h b/moses/FF/TreeStructureFeature.h
index 361e8cc6a..353328466 100644
--- a/moses/FF/TreeStructureFeature.h
+++ b/moses/FF/TreeStructureFeature.h
@@ -63,22 +63,6 @@ public:
void SetParameter(const std::string& key, const std::string& value);
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedScores) const {};
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedScores = NULL) const {};
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const {
- }
-
-
FFState* EvaluateWhenApplied(
const Hypothesis& cur_hypo,
const FFState* prev_state,