diff options
author | bhaddow <barry.haddow@gmail.com> | 2011-09-20 14:23:38 +0400 |
---|---|---|
committer | bhaddow <barry.haddow@gmail.com> | 2011-09-20 14:23:38 +0400 |
commit | 5b7c5ebdb50c84a05afef1f479049d82be668b8e (patch) | |
tree | b89ff733bf9aad1e9890af270558db4951b9f6f0 /moses-chart-cmd | |
parent | 2dd9e4cc7c3b8ba549376483c80bab551bc9bff5 (diff) | |
parent | a064f799e06e8ee6fdb5f8d579e297b645ea97d8 (diff) |
Merge branch 'master' into miramerge
Conflicts:
moses-chart-cmd/src/Main.cpp
moses-cmd/src/IOWrapper.cpp
moses-cmd/src/Main.cpp
moses/src/DummyScoreProducers.cpp
moses/src/DummyScoreProducers.h
moses/src/GenerationDictionary.cpp
moses/src/GenerationDictionary.h
moses/src/GlobalLexicalModel.h
moses/src/LMList.h
moses/src/LanguageModel.cpp
moses/src/LanguageModel.h
moses/src/LanguageModelImplementation.h
moses/src/LanguageModelKen.h
moses/src/LanguageModelMultiFactor.cpp
moses/src/LanguageModelMultiFactor.h
moses/src/LanguageModelSingleFactor.cpp
moses/src/LanguageModelSingleFactor.h
moses/src/LexicalReordering.h
moses/src/PhraseDictionary.cpp
moses/src/PhraseDictionary.h
moses/src/ScoreIndexManager.cpp
moses/src/ScoreProducer.h
moses/src/StaticData.cpp
moses/src/StaticData.h
moses/src/TranslationSystem.cpp
Diffstat (limited to 'moses-chart-cmd')
-rw-r--r-- | moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj | 10 | ||||
-rw-r--r-- | moses-chart-cmd/src/IOWrapper.cpp | 92 |
2 files changed, 45 insertions, 57 deletions
diff --git a/moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj b/moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj index c9da6b792..51136e248 100644 --- a/moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj +++ b/moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj @@ -297,6 +297,11 @@ GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + TRACE_ENABLE, + _LARGE_FILES, + "_FILE_OFFSET_BITS=64", + ); HEADER_SEARCH_PATHS = ../moses/src; INSTALL_PATH = /usr/local/bin; LIBRARY_SEARCH_PATHS = ( @@ -325,6 +330,11 @@ ALWAYS_SEARCH_USER_PATHS = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; + GCC_PREPROCESSOR_DEFINITIONS = ( + TRACE_ENABLE, + _LARGE_FILES, + "_FILE_OFFSET_BITS=64", + ); HEADER_SEARCH_PATHS = ../moses/src; INSTALL_PATH = /usr/local/bin; LIBRARY_SEARCH_PATHS = ( diff --git a/moses-chart-cmd/src/IOWrapper.cpp b/moses-chart-cmd/src/IOWrapper.cpp index ed6112e00..ba6ce4f59 100644 --- a/moses-chart-cmd/src/IOWrapper.cpp +++ b/moses-chart-cmd/src/IOWrapper.cpp @@ -361,77 +361,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 << " 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(); |