diff options
author | germann <germann@vali.inf.ed.ac.uk> | 2014-03-24 14:55:47 +0400 |
---|---|---|
committer | germann <germann@vali.inf.ed.ac.uk> | 2014-03-24 14:55:47 +0400 |
commit | f7ec2ee09a80446969bb1dcd3afb56aea7ec3a2e (patch) | |
tree | afd94afb8af4bc942cb3c8800e1e8f550ca54c95 /moses/InputPath.cpp | |
parent | ec6fd216035931f649b890982cd6de01e1c67c3f (diff) |
1. Fixed order of initializations in constructor so gcc won't complain.
2. Added call to PhraseDictionary.release(TargetPhraseCollection*) to
release used TargetPhraseCollection's.
Diffstat (limited to 'moses/InputPath.cpp')
-rw-r--r-- | moses/InputPath.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/moses/InputPath.cpp b/moses/InputPath.cpp index 786cfa8a4..7a6464aac 100644 --- a/moses/InputPath.cpp +++ b/moses/InputPath.cpp @@ -5,7 +5,7 @@ #include "TypeDef.h" #include "AlignmentInfo.h" #include "util/exception.hh" - +#include "TranslationModel/PhraseDictionary.h" using namespace std; namespace Moses @@ -18,8 +18,8 @@ InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms, ,m_phrase(phrase) ,m_range(range) ,m_inputScore(inputScore) - ,m_sourceNonTerms(sourceNonTerms) ,m_nextNode(1) + ,m_sourceNonTerms(sourceNonTerms) { //cerr << "phrase=" << phrase << " m_inputScore=" << *m_inputScore << endl; @@ -27,6 +27,14 @@ InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms, InputPath::~InputPath() { + // Since there is no way for the Phrase Dictionaries to tell in + // which (sentence) context phrases were looked up, we tell them + // now that the phrase isn't needed any more by this inputPath + typedef std::pair<const TargetPhraseCollection*, const void* > entry; + std::map<const PhraseDictionary*, entry>::const_iterator iter; + for (iter = m_targetPhrases.begin(); iter != m_targetPhrases.end(); ++iter) + iter->first->release(iter->second.first); + delete m_inputScore; } |