From ff930869244b39fdc97104b78ae46f8a24957b35 Mon Sep 17 00:00:00 2001 From: bhaddow Date: Fri, 17 Sep 2010 08:33:22 +0000 Subject: [PATCH] Force the initialisation of the phrase dictionary git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/branches/mira-mtm5@3499 1f5c12ca-751b-0410-a591-d2e778427230 --- mira/Decoder.cpp | 9 +++++++++ mira/Decoder.h | 4 +--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mira/Decoder.cpp b/mira/Decoder.cpp index 5bbc721ac..2e3caae17 100644 --- a/mira/Decoder.cpp +++ b/mira/Decoder.cpp @@ -63,6 +63,15 @@ namespace Mira { } delete[] mosesargv; } + + MosesDecoder::MosesDecoder() + : m_manager(NULL) + { + //force initialisation of the phrase dictionary + string source("hello"); + MosesChart::TrellisPathList sentences; + getNBest(source,1,sentences); + } void MosesDecoder::cleanup() { diff --git a/mira/Decoder.h b/mira/Decoder.h index 38acff96e..3422c3947 100644 --- a/mira/Decoder.h +++ b/mira/Decoder.h @@ -62,9 +62,7 @@ class Decoder { **/ class MosesDecoder : public Decoder { public: - MosesDecoder() - : m_manager(NULL) - {} + MosesDecoder(); virtual void getNBest(const std::string& source, size_t count, MosesChart::TrellisPathList& sentences); void cleanup();