From ba166f109cc1bda482e32ba490905d769dc1b9ae Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Tue, 30 Dec 2014 18:53:30 +0530 Subject: moving more stuff out of IOWrapper --- moses/ScoreComponentCollection.cpp | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'moses/ScoreComponentCollection.cpp') diff --git a/moses/ScoreComponentCollection.cpp b/moses/ScoreComponentCollection.cpp index eedaa589e..2903b112c 100644 --- a/moses/ScoreComponentCollection.cpp +++ b/moses/ScoreComponentCollection.cpp @@ -3,6 +3,8 @@ #include "util/exception.hh" #include "ScoreComponentCollection.h" #include "StaticData.h" +#include "moses/FF/StatelessFeatureFunction.h" +#include "moses/FF/StatefulFeatureFunction.h" using namespace std; @@ -301,6 +303,52 @@ void ScoreComponentCollection::PlusEquals(const FeatureFunction* sp, const Score } } +void ScoreComponentCollection::OutputAllFeatureScores(std::ostream &out) const +{ + std::string lastName = ""; + const vector& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); + for( size_t i=0; iGetScoreProducerDescription() != "BleuScoreFeature" + && ff->IsTuneable()) { + OutputFeatureScores( out, ff, lastName ); + } + } + const vector& slf = StatelessFeatureFunction::GetStatelessFeatureFunctions(); + for( size_t i=0; iIsTuneable()) { + OutputFeatureScores( out, ff, lastName ); + } + } +} + +void ScoreComponentCollection::OutputFeatureScores( std::ostream& out + , const FeatureFunction *ff + , std::string &lastName ) const +{ + const StaticData &staticData = StaticData::Instance(); + bool labeledOutput = staticData.IsLabeledNBestList(); + + // regular features (not sparse) + if (ff->GetNumScoreComponents() != 0) { + if( labeledOutput && lastName != ff->GetScoreProducerDescription() ) { + lastName = ff->GetScoreProducerDescription(); + out << " " << lastName << "="; + } + vector scores = GetScoresForProducer( ff ); + for (size_t j = 0; jfirst << "= " << i->second; + } +} + } -- cgit v1.2.3