diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-31 15:50:52 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-31 15:50:52 +0300 |
commit | 324c378f7fc54f02a8ea264915d3eade867ff23d (patch) | |
tree | 2bb934fee448845b0524427d437c871e7118ac2c /moses/ScoreComponentCollection.cpp | |
parent | dc8ad899454bd82408c6a371d5f50e497ede0caa (diff) |
Options refactoring. Moses crashed in server mode when asked to provide n-best translations with scores.
Diffstat (limited to 'moses/ScoreComponentCollection.cpp')
-rw-r--r-- | moses/ScoreComponentCollection.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/moses/ScoreComponentCollection.cpp b/moses/ScoreComponentCollection.cpp index d9810224e..1a9af8e57 100644 --- a/moses/ScoreComponentCollection.cpp +++ b/moses/ScoreComponentCollection.cpp @@ -305,35 +305,38 @@ void ScoreComponentCollection::PlusEquals(const FeatureFunction* sp, const Score } } -void ScoreComponentCollection::OutputAllFeatureScores(std::ostream &out) const +void +ScoreComponentCollection:: +OutputAllFeatureScores(std::ostream &out, bool with_labels) const { std::string lastName = ""; const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); for( size_t i=0; i<sff.size(); i++ ) { const StatefulFeatureFunction *ff = sff[i]; if (ff->IsTuneable()) { - OutputFeatureScores( out, ff, lastName ); + OutputFeatureScores(out, ff, lastName, with_labels); } } const vector<const StatelessFeatureFunction*>& slf = StatelessFeatureFunction::GetStatelessFeatureFunctions(); for( size_t i=0; i<slf.size(); i++ ) { const StatelessFeatureFunction *ff = slf[i]; if (ff->IsTuneable()) { - OutputFeatureScores( out, ff, lastName ); + OutputFeatureScores(out, ff, lastName, with_labels); } } } -void ScoreComponentCollection::OutputFeatureScores( std::ostream& out - , const FeatureFunction *ff - , std::string &lastName ) const +void +ScoreComponentCollection:: +OutputFeatureScores(std::ostream& out, FeatureFunction const* ff, + std::string &lastName, bool with_labels) const { - const StaticData &staticData = StaticData::Instance(); - bool labeledOutput = staticData.options().nbest.include_feature_labels; + // const StaticData &staticData = StaticData::Instance(); + // bool labeledOutput = staticData.options().nbest.include_feature_labels; // regular features (not sparse) if (ff->HasTuneableComponents()) { - if( labeledOutput && lastName != ff->GetScoreProducerDescription() ) { + if( with_labels && lastName != ff->GetScoreProducerDescription() ) { lastName = ff->GetScoreProducerDescription(); out << " " << lastName << "="; } |