diff options
author | Eva Hasler <evahasler@gmail.com> | 2012-01-18 16:26:51 +0400 |
---|---|---|
committer | Eva Hasler <evahasler@gmail.com> | 2012-01-18 16:26:51 +0400 |
commit | b704381a4267c8551a92f93bafcb92cfda0f5903 (patch) | |
tree | 247895ae43eaf1842024b0b4b28b0d946bb59769 /moses-chart-cmd | |
parent | f4aba433b456c8f35c1ecaeee53333bbf22e39e6 (diff) |
restore order of scores returned by decoder and in nbestlist
Diffstat (limited to 'moses-chart-cmd')
-rw-r--r-- | moses-chart-cmd/src/IOWrapper.cpp | 14 | ||||
-rw-r--r-- | moses-chart-cmd/src/Main.cpp | 21 |
2 files changed, 14 insertions, 21 deletions
diff --git a/moses-chart-cmd/src/IOWrapper.cpp b/moses-chart-cmd/src/IOWrapper.cpp index 7f13e50b2..616874fa7 100644 --- a/moses-chart-cmd/src/IOWrapper.cpp +++ b/moses-chart-cmd/src/IOWrapper.cpp @@ -367,6 +367,12 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha std::string lastName = ""; + // output stateful sparse features + const vector<const StatefulFeatureFunction*>& sff = system->GetStatefulFeatureFunctions(); + for( size_t i=0; i<sff.size(); i++ ) + if (sff[i]->GetNumScoreComponents() == ScoreProducer::unlimited) + OutputSparseFeatureScores( out, path, sff[i], lastName ); + // translation components const vector<PhraseDictionaryFeature*>& pds = system->GetPhraseDictionaries(); if (pds.size() > 0) { @@ -408,19 +414,13 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha } } - // output sparse features + // output stateless sparse features lastName = ""; - const vector<const StatefulFeatureFunction*>& sff = system->GetStatefulFeatureFunctions(); - for( size_t i=0; i<sff.size(); i++ ) - if (sff[i]->GetNumScoreComponents() == ScoreProducer::unlimited) - OutputSparseFeatureScores( out, path, sff[i], lastName ); - const vector<const StatelessFeatureFunction*>& slf = system->GetStatelessFeatureFunctions(); for( size_t i=0; i<slf.size(); i++ ) if (sff[i]->GetNumScoreComponents() == ScoreProducer::unlimited) OutputSparseFeatureScores( out, path, slf[i], lastName ); - // total out << " ||| " << path.GetTotalScore(); diff --git a/moses-chart-cmd/src/Main.cpp b/moses-chart-cmd/src/Main.cpp index 93dd1064f..0a5cdbbc3 100644 --- a/moses-chart-cmd/src/Main.cpp +++ b/moses-chart-cmd/src/Main.cpp @@ -173,17 +173,13 @@ static void PrintFeatureWeight(const FeatureFunction* ff) << ff->GetScoreProducerWeightShortName() << " " << values[i] << endl; } -} - -static void PrintSparseFeatureWeight(const FeatureFunction* ff) -{ - if (ff->GetNumScoreComponents() == ScoreProducer::unlimited) { - if (ff->GetSparseProducerWeight() == 1) - cout << ff->GetScoreProducerDescription() << " " << - ff->GetScoreProducerWeightShortName() << " sparse" << endl; - else - cout << ff->GetScoreProducerDescription() << " " << - ff->GetScoreProducerWeightShortName() << " " << ff->GetSparseProducerWeight() << endl; + else { + if (ff->GetSparseProducerWeight() == 1) + cout << ff->GetScoreProducerDescription() << " " << + ff->GetScoreProducerWeightShortName() << " sparse" << endl; + else + cout << ff->GetScoreProducerDescription() << " " << + ff->GetScoreProducerWeightShortName() << " " << ff->GetSparseProducerWeight() << endl; } } @@ -208,9 +204,6 @@ static void ShowWeights() for (size_t i = 0; i < slf.size(); ++i) { PrintFeatureWeight(slf[i]); } - for (size_t i = 0; i < sff.size(); ++i) { - PrintSparseFeatureWeight(sff[i]); - } } |