Revert "delete cache"

This reverts commit bd5d308bf2.
This commit is contained in:
Hieu Hoang 2016-02-18 10:46:01 -05:00
parent bd5d308bf2
commit 50abed8499
2 changed files with 11 additions and 3 deletions

View File

@ -101,14 +101,14 @@ void KENLM::Load(System &system)
void KENLM::InitializeForInput(const Manager &mgr) const
{
mgr.lmCache = new CacheColl();
CacheColl &cache = GetCache();
cache.clear();
mgr.lmCache = &cache;
}
// clean up temporary memory, called after processing each sentence
void KENLM::CleanUpAfterSentenceProcessing(const Manager &mgr) const
{
CacheColl *lmCache = (CacheColl*)mgr.lmCache;
delete lmCache;
}
void KENLM::SetParameter(const std::string& key, const std::string& value)
@ -340,5 +340,10 @@ const KENLM::LMCacheValue &KENLM::ScoreAndCache(const Manager &mgr, const lm::ng
return *val;
}
KENLM::CacheColl &KENLM::GetCache() const
{
return GetThreadSpecificObj(m_cache);
}
}

View File

@ -96,6 +96,9 @@ protected:
lm::WordIndex *LastIDs(const Hypothesis &hypo, lm::WordIndex *indices) const;
const LMCacheValue &ScoreAndCache(const Manager &mgr, const lm::ngram::State &in_state, const lm::WordIndex new_word) const;
CacheColl &GetCache() const;
};
}