mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
restore order of scores returned by decoder and in nbestlist
This commit is contained in:
parent
f4aba433b4
commit
b704381a42
@ -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();
|
||||
|
||||
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -295,17 +295,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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -321,18 +317,15 @@ 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 **/
|
||||
|
Loading…
Reference in New Issue
Block a user