mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
parent
bd5d308bf2
commit
50abed8499
@ -101,14 +101,14 @@ void KENLM::Load(System &system)
|
|||||||
|
|
||||||
void KENLM::InitializeForInput(const Manager &mgr) const
|
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
|
// clean up temporary memory, called after processing each sentence
|
||||||
void KENLM::CleanUpAfterSentenceProcessing(const Manager &mgr) const
|
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)
|
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;
|
return *val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KENLM::CacheColl &KENLM::GetCache() const
|
||||||
|
{
|
||||||
|
return GetThreadSpecificObj(m_cache);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +96,9 @@ protected:
|
|||||||
lm::WordIndex *LastIDs(const Hypothesis &hypo, lm::WordIndex *indices) const;
|
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;
|
const LMCacheValue &ScoreAndCache(const Manager &mgr, const lm::ngram::State &in_state, const lm::WordIndex new_word) const;
|
||||||
|
|
||||||
|
CacheColl &GetCache() const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user