From de009c1fca02f8bcd60cb65f39eaa8d8d80c118c Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Wed, 15 Feb 2017 10:30:13 +0000 Subject: change NO_COMPACT_TABLES -> HAVE_CMPH --- moses2/FF/LexicalReordering/LexicalReordering.cpp | 28 +++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'moses2/FF/LexicalReordering/LexicalReordering.cpp') diff --git a/moses2/FF/LexicalReordering/LexicalReordering.cpp b/moses2/FF/LexicalReordering/LexicalReordering.cpp index 292df42a4..c84b30a59 100644 --- a/moses2/FF/LexicalReordering/LexicalReordering.cpp +++ b/moses2/FF/LexicalReordering/LexicalReordering.cpp @@ -12,9 +12,6 @@ #include "PhraseBasedReorderingState.h" #include "BidirectionalReorderingState.h" #include "../../TranslationModel/PhraseTable.h" -#ifndef NO_COMPACT_TABLES -#include "../../TranslationModel/CompactPT/LexicalReorderingTableCompact.h" -#endif #include "../../System.h" #include "../../PhraseBased/PhraseImpl.h" #include "../../PhraseBased/Manager.h" @@ -24,6 +21,11 @@ #include "../../legacy/InputFileStream.h" #include "../../legacy/Util2.h" +#ifdef HAVE_CMPH +#include "../../TranslationModel/CompactPT/LexicalReorderingTableCompact.h" +#endif + + using namespace std; namespace Moses2 @@ -31,9 +33,15 @@ namespace Moses2 /////////////////////////////////////////////////////////////////////// -LexicalReordering::LexicalReordering(size_t startInd, const std::string &line) : - StatefulFeatureFunction(startInd, line), m_compactModel(NULL), m_blank( - NULL), m_propertyInd(-1), m_coll(NULL), m_configuration(NULL) +LexicalReordering::LexicalReordering(size_t startInd, const std::string &line) +: StatefulFeatureFunction(startInd, line) +, m_blank(NULL) +, m_propertyInd(-1) +, m_coll(NULL) +, m_configuration(NULL) +#ifdef HAVE_CMPH +, m_compactModel(NULL) +#endif { ReadParameters(); assert(m_configuration); @@ -42,9 +50,11 @@ LexicalReordering::LexicalReordering(size_t startInd, const std::string &line) : LexicalReordering::~LexicalReordering() { - delete m_compactModel; delete m_coll; delete m_configuration; +#ifdef HAVE_CMPH + delete m_compactModel; +#endif } void LexicalReordering::Load(System &system) @@ -53,7 +63,7 @@ void LexicalReordering::Load(System &system) if (m_propertyInd >= 0) { // Using integrate Lex RO. No loading needed -#ifndef NO_COMPACT_TABLES +#ifdef HAVE_CMPH } else if (FileExists(m_path + ".minlexr")) { m_compactModel = new LexicalReorderingTableCompact(m_path + ".minlexr", m_FactorsF, m_FactorsE, m_FactorsC); @@ -149,7 +159,7 @@ void LexicalReordering::EvaluateAfterTablePruning(MemPool &pool, if (m_propertyInd >= 0) { SCORE *scoreArr = targetPhrase.GetScoresProperty(m_propertyInd); targetPhrase.ffData[m_PhraseTableInd] = scoreArr; -#ifndef NO_COMPACT_TABLES +#ifdef HAVE_CMPH } else if (m_compactModel) { // using external compact binary model const Values values = m_compactModel->GetScore(sourcePhrase, targetPhrase, -- cgit v1.2.3