diff options
author | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-08-30 16:25:50 +0400 |
---|---|---|
committer | nicolabertoldi <nicolabertoldi@1f5c12ca-751b-0410-a591-d2e778427230> | 2011-08-30 16:25:50 +0400 |
commit | 75edc2edddd42a03a7f835672871b5de83825fae (patch) | |
tree | c2f02c44eed2fac0dd97186f9f41652c424cebe5 /moses-chart-cmd | |
parent | ca1912961d698d507bb40891389664dab9c73ba6 (diff) |
change to print the corrett name of the features with InputScores
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4168 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses-chart-cmd')
-rw-r--r-- | moses-chart-cmd/src/IOWrapper.cpp | 90 | ||||
-rw-r--r-- | moses-chart-cmd/src/Main.cpp | 2 |
2 files changed, 35 insertions, 57 deletions
diff --git a/moses-chart-cmd/src/IOWrapper.cpp b/moses-chart-cmd/src/IOWrapper.cpp index 48f9bd7ca..7f246205a 100644 --- a/moses-chart-cmd/src/IOWrapper.cpp +++ b/moses-chart-cmd/src/IOWrapper.cpp @@ -359,77 +359,55 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha } } - // translation components - if (StaticData::Instance().GetInputType()==SentenceInput) { - // translation components for text input - vector<PhraseDictionaryFeature*> pds = system->GetPhraseDictionaries(); - if (pds.size() > 0) { - if (labeledOutput) - out << "tm: "; - vector<PhraseDictionaryFeature*>::iterator iter; - for (iter = pds.begin(); iter != pds.end(); ++iter) { - vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter); - for (size_t j = 0; j<scores.size(); ++j) - out << scores[j] << " "; - } - } - } else { - // translation components for Confusion Network input - // first translation component has GetNumInputScores() scores from the input Confusion Network - // at the beginning of the vector - vector<PhraseDictionaryFeature*> pds = system->GetPhraseDictionaries(); - if (pds.size() > 0) { - vector<PhraseDictionaryFeature*>::iterator iter; - - iter = pds.begin(); - vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter); - - size_t pd_numinputscore = (*iter)->GetNumInputScores(); - - if (pd_numinputscore) { - - if (labeledOutput) - out << "I: "; - - for (size_t j = 0; j < pd_numinputscore; ++j) - out << scores[j] << " "; - } - - for (iter = pds.begin() ; iter != pds.end(); ++iter) { - vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter); + std::string lastName = ""; - size_t pd_numinputscore = (*iter)->GetNumInputScores(); - - if (iter == pds.begin() && labeledOutput) - out << "tm: "; - for (size_t j = pd_numinputscore; j < scores.size() ; ++j) - out << scores[j] << " "; - } + // translation components + const vector<PhraseDictionaryFeature*>& pds = system->GetPhraseDictionaries(); + if (pds.size() > 0) { + + for( size_t i=0; i<pds.size(); i++ ) { + size_t pd_numinputscore = pds[i]->GetNumInputScores(); + vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer( pds[i] ); + for (size_t j = 0; j<scores.size(); ++j){ + + if (labeledOutput && (i == 0) ){ + if ((j == 0) || (j == pd_numinputscore)){ + lastName = pds[i]->GetScoreProducerWeightShortName(j); + out << " " << lastName << ":"; + } + } + out << " " << scores[j]; + } } } - - // word penalty if (labeledOutput) out << "w: "; out << path.GetScoreBreakdown().GetScoreForProducer(system->GetWordPenaltyProducer()) << " "; // generation - const vector<GenerationDictionary*> gds = system->GetGenerationDictionaries(); + const vector<GenerationDictionary*>& gds = system->GetGenerationDictionaries(); if (gds.size() > 0) { - if (labeledOutput) - out << "g: "; - vector<GenerationDictionary*>::const_iterator iter; - for (iter = gds.begin(); iter != gds.end(); ++iter) { - vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter); - for (size_t j = 0; j<scores.size(); j++) { - out << scores[j] << " "; - } + + for( size_t i=0; i<gds.size(); i++ ) { + size_t pd_numinputscore = gds[i]->GetNumInputScores(); + vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer( gds[i] ); + for (size_t j = 0; j<scores.size(); ++j){ + + if (labeledOutput && (i == 0) ){ + if ((j == 0) || (j == pd_numinputscore)){ + lastName = gds[i]->GetScoreProducerWeightShortName(j); + out << " " << lastName << ":"; + } + } + out << " " << scores[j]; + } } } + // total out << "||| " << path.GetTotalScore(); diff --git a/moses-chart-cmd/src/Main.cpp b/moses-chart-cmd/src/Main.cpp index f86b128e9..7032bf849 100644 --- a/moses-chart-cmd/src/Main.cpp +++ b/moses-chart-cmd/src/Main.cpp @@ -170,7 +170,7 @@ static void PrintFeatureWeight(const FeatureFunction* ff) size_t weightStart = StaticData::Instance().GetScoreIndexManager().GetBeginIndex(ff->GetScoreBookkeepingID()); size_t weightEnd = StaticData::Instance().GetScoreIndexManager().GetEndIndex(ff->GetScoreBookkeepingID()); for (size_t i = weightStart; i < weightEnd; ++i) { - cout << ff->GetScoreProducerDescription() << " " << ff->GetScoreProducerWeightShortName() << " " + cout << ff->GetScoreProducerDescription(i-weightStart) << " " << ff->GetScoreProducerWeightShortName(i-weightStart) << " " << StaticData::Instance().GetAllWeights()[i] << endl; } } |