Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieu@hoang.co.uk>2013-05-27 19:50:21 +0400
committerHieu Hoang <hieu@hoang.co.uk>2013-05-27 19:50:21 +0400
commit06a5c8669535bbc2324a9288ca770b1d1e9d6071 (patch)
treebc3dcfcf2cd4b9a5539947ca5aeb4089d58d9517 /moses-cmd
parent9006ee98be01850cdb37967a392b176087f4c8c0 (diff)
delete LMList
Diffstat (limited to 'moses-cmd')
-rw-r--r--moses-cmd/TranslationAnalysis.cpp23
1 files changed, 15 insertions, 8 deletions
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<unsigned int>::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<unsigned int>::iterator acc = lmAcc.begin();
+
+ const std::vector<const StatefulFeatureFunction*> &statefulFFs = StatefulFeatureFunction::GetStatefulFeatureFunctions();
+ for (size_t i = 0; i < statefulFFs.size(); ++i) {
+ const StatefulFeatureFunction *ff = statefulFFs[i];
+ const LanguageModel *lm = dynamic_cast<const LanguageModel*>(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) {