mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-08 12:36:35 +03:00
add score to set weights in the right position in the global score vector so things aren't so brittle
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@423 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
540aadea2b
commit
472abe01a3
@ -617,4 +617,16 @@ void StaticData::InitializeBeforeSentenceProcessing(InputType const& in)
|
||||
{
|
||||
for(size_t i=0;i<m_phraseDictionary.size();++i)
|
||||
m_phraseDictionary[i]->InitializeForInput(in);
|
||||
}
|
||||
}
|
||||
|
||||
void StaticData::SetWeightsForScoreProducer(const ScoreProducer* sp, const std::vector<float>& weights)
|
||||
{
|
||||
const size_t id = sp->GetScoreBookkeepingID();
|
||||
const size_t begin = m_scoreIndexManager.GetBeginIndex(id);
|
||||
const size_t end = m_scoreIndexManager.GetEndIndex(id);
|
||||
assert(end - begin == weights.size());
|
||||
std::vector<float>::const_iterator weightIter = weights.begin();
|
||||
for (size_t i = begin; i < end; i++)
|
||||
m_allWeights[i] = *weightIter++;
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,9 @@ protected:
|
||||
|
||||
mutable SentenceStats m_sentenceStats;
|
||||
|
||||
//! Sets the global score vector weights for a given ScoreProducer.
|
||||
void SetWeightsForScoreProducer(const ScoreProducer* sp, const std::vector<float>& weights);
|
||||
|
||||
public:
|
||||
StaticData();
|
||||
~StaticData();
|
||||
@ -222,8 +225,11 @@ public:
|
||||
{
|
||||
return m_languageModel[Initial].size() + m_languageModel[Other].size();
|
||||
}
|
||||
size_t GetNumLanguageModels() const
|
||||
{
|
||||
return GetLMSize();
|
||||
}
|
||||
const LMList GetAllLM() const;
|
||||
|
||||
size_t GetPhraseDictionarySize() const
|
||||
{
|
||||
return m_phraseDictionary.size();
|
||||
|
Loading…
Reference in New Issue
Block a user