Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ScoreComponentCollection.cpp « src « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fee7e62ea0f47f1cc6f52f16f51ff6d3744c3731 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// $Id$

#include "ScoreComponentCollection.h"
#include "StaticData.h"

namespace Moses
{
ScoreComponentCollection::ScoreComponentCollection()
  : m_scores(StaticData::Instance().GetTotalScoreComponents(), 0.0f)
  , m_sim(&StaticData::Instance().GetScoreIndexManager())
{}

float ScoreComponentCollection::GetWeightedScore() const
{
  float ret = InnerProduct(StaticData::Instance().GetAllWeights());
  return ret;
}

void ScoreComponentCollection::ZeroAllLM(const LMList& lmList)
{

  for (size_t ind = lmList.GetMinIndex(); ind <= lmList.GetMaxIndex(); ++ind) {
    m_scores[ind] = 0;
  }
}

void ScoreComponentCollection::PlusEqualsAllLM(const LMList& lmList, const ScoreComponentCollection& rhs)
{

  for (size_t ind = lmList.GetMinIndex(); ind <= lmList.GetMaxIndex(); ++ind) {
    m_scores[ind] += rhs.m_scores[ind];
  }

}

}