From 06a5c8669535bbc2324a9288ca770b1d1e9d6071 Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Mon, 27 May 2013 16:50:21 +0100 Subject: delete LMList --- moses-cmd/TranslationAnalysis.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'moses-cmd') diff --git a/moses-cmd/TranslationAnalysis.cpp b/moses-cmd/TranslationAnalysis.cpp index 186378ca5..4231001e9 100644 --- a/moses-cmd/TranslationAnalysis.cpp +++ b/moses-cmd/TranslationAnalysis.cpp @@ -101,14 +101,21 @@ void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo) } os << std::endl << std::endl; if (doLMStats && lmCalls > 0) { - std::vector::iterator acc = lmAcc.begin(); - const LMList &lmList = StaticData::Instance().GetLMList(); - LMList::const_iterator i = lmList.begin(); - for (; acc != lmAcc.end(); ++acc, ++i) { - char buf[256]; - sprintf(buf, "%.4f", (float)(*acc)/(float)lmCalls); - os << (*i)->GetScoreProducerDescription() <<", AVG N-GRAM LENGTH: " << buf << std::endl; - } + std::vector::iterator acc = lmAcc.begin(); + + const std::vector &statefulFFs = StatefulFeatureFunction::GetStatefulFeatureFunctions(); + for (size_t i = 0; i < statefulFFs.size(); ++i) { + const StatefulFeatureFunction *ff = statefulFFs[i]; + const LanguageModel *lm = dynamic_cast(ff); + + if (lm) { + char buf[256]; + sprintf(buf, "%.4f", (float)(*acc)/(float)lmCalls); + os << lm->GetScoreProducerDescription() <<", AVG N-GRAM LENGTH: " << buf << std::endl; + + ++acc; + } + } } if (droppedWords.size() > 0) { -- cgit v1.2.3