diff options
author | Eva Hasler <ehasler@saxnot.inf.ed.ac.uk> | 2011-12-14 14:51:35 +0400 |
---|---|---|
committer | Eva Hasler <ehasler@saxnot.inf.ed.ac.uk> | 2011-12-14 14:51:35 +0400 |
commit | 50d3a62bda9e2b8d1b54813bdec893dac1c79359 (patch) | |
tree | 945bf9a7b8668d59ee579b0b5b1e994ca4348d03 /moses-cmd | |
parent | 8a45f2275177a955399173f5cf82871e98d3e5bd (diff) |
change order of -show-weights output to match nbest list order
Diffstat (limited to 'moses-cmd')
-rw-r--r-- | moses-cmd/src/Main.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/moses-cmd/src/Main.cpp b/moses-cmd/src/Main.cpp index ea132b08b..04fc0ad2c 100644 --- a/moses-cmd/src/Main.cpp +++ b/moses-cmd/src/Main.cpp @@ -287,25 +287,27 @@ private: static void PrintFeatureWeight(const FeatureFunction* ff) { - size_t numScoreComps = ff->GetNumScoreComponents(); if (numScoreComps != ScoreProducer::unlimited) { vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff); - for (size_t i = 0; i < numScoreComps; ++i) { + for (size_t i = 0; i < numScoreComps; ++i) cout << ff->GetScoreProducerDescription() << " " << ff->GetScoreProducerWeightShortName() << " " << values[i] << endl; - } - } else { - if (ff->GetSparseProducerWeight() == 1) - cout << ff->GetScoreProducerDescription() << " " << - ff->GetScoreProducerWeightShortName() << " sparse" << endl; - else - cout << ff->GetScoreProducerDescription() << " " << - ff->GetScoreProducerWeightShortName() << " " << ff->GetSparseProducerWeight() << 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; + } +} static void ShowWeights() { @@ -319,15 +321,18 @@ static void ShowWeights() for (size_t i = 0; i < sff.size(); ++i) { PrintFeatureWeight(sff[i]); } - for (size_t i = 0; i < slf.size(); ++i) { - PrintFeatureWeight(slf[i]); - } for (size_t i = 0; i < pds.size(); ++i) { PrintFeatureWeight(pds[i]); } for (size_t i = 0; i < gds.size(); ++i) { PrintFeatureWeight(gds[i]); } + for (size_t i = 0; i < slf.size(); ++i) { + PrintFeatureWeight(slf[i]); + } + for (size_t i = 0; i < sff.size(); ++i) { + PrintSparseFeatureWeight(sff[i]); + } } /** main function of the command line version of the decoder **/ |