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-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-cmd')
-rwxr-xr-x | moses-cmd/src/IOWrapper.cpp | 92 | ||||
-rw-r--r-- | moses-cmd/src/Main.cpp | 3 |
2 files changed, 35 insertions, 60 deletions
diff --git a/moses-cmd/src/IOWrapper.cpp b/moses-cmd/src/IOWrapper.cpp index abf569ca9..5dac23560 100755 --- a/moses-cmd/src/IOWrapper.cpp +++ b/moses-cmd/src/IOWrapper.cpp @@ -383,8 +383,7 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con out << " |||"; std::string lastName = ""; - const vector<const StatefulFeatureFunction*>& sff = - system->GetStatefulFeatureFunctions(); + const vector<const StatefulFeatureFunction*>& sff = system->GetStatefulFeatureFunctions(); for( size_t i=0; i<sff.size(); i++ ) { if( labeledOutput && lastName != sff[i]->GetScoreProducerWeightShortName() ) { lastName = sff[i]->GetScoreProducerWeightShortName(); @@ -396,8 +395,7 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con } } - const vector<const StatelessFeatureFunction*>& slf = - system->GetStatelessFeatureFunctions(); + const vector<const StatelessFeatureFunction*>& slf = system->GetStatelessFeatureFunctions(); for( size_t i=0; i<slf.size(); i++ ) { if( labeledOutput && lastName != slf[i]->GetScoreProducerWeightShortName() ) { lastName = slf[i]->GetScoreProducerWeightShortName(); @@ -410,66 +408,42 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con } // 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); - - 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]; - } + 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]; + } } } // 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]; + } } } diff --git a/moses-cmd/src/Main.cpp b/moses-cmd/src/Main.cpp index 3720f4256..69fd9c797 100644 --- a/moses-cmd/src/Main.cpp +++ b/moses-cmd/src/Main.cpp @@ -279,7 +279,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; } } @@ -335,6 +335,7 @@ int main(int argc, char** argv) exit(1); } + // create threadpool, if using multi-threaded decoding // note: multi-threading is done on sentence-level, // each thread translates one sentence |