diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-06-06 21:54:44 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-06-06 21:54:44 +0400 |
commit | df4b8e58284f60264efdf7e3dcb9f517e71e4701 (patch) | |
tree | c533c2d8e21435f94621fc72d3c1bbb77b680f10 /moses/PDTAimp.h | |
parent | f437ab52e1ee3ba89f7763c11c9b28409ee5083a (diff) |
m_numInputScores deleted from PhraseDictionary.
Diffstat (limited to 'moses/PDTAimp.h')
-rw-r--r-- | moses/PDTAimp.h | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/moses/PDTAimp.h b/moses/PDTAimp.h index 20a4abe97..e76e7da79 100644 --- a/moses/PDTAimp.h +++ b/moses/PDTAimp.h @@ -35,9 +35,24 @@ class PDTAimp friend class PhraseDictionaryTreeAdaptor; protected: - PDTAimp(PhraseDictionaryTreeAdaptor *p,unsigned nis) + PDTAimp(PhraseDictionaryTreeAdaptor *p) : m_dict(0), - m_obj(p),useCache(1),m_numInputScores(nis),totalE(0),distinctE(0) {} + m_obj(p), + useCache(1), + totalE(0), + distinctE(0) + { + m_numInputScores = 0; + const StaticData &staticData = StaticData::Instance(); + const InputFeature *inputFeature = staticData.GetInputFeature(); + + if (inputFeature) { + const PhraseDictionary *firstPt = staticData.GetPhraseDictionaries()[0]; + if (firstPt == m_obj) { + m_numInputScores = inputFeature->GetNumScoreComponents(); + } + } + } public: std::vector<FactorType> m_input,m_output; @@ -278,16 +293,12 @@ public: const StaticData &staticData = StaticData::Instance(); const InputFeature *inputFeature = staticData.GetInputFeature(); - if (inputFeature) { - const PhraseDictionary *firstPt = staticData.GetPhraseDictionaries()[0]; - if (firstPt == m_obj) { - size_t numInputScores = inputFeature->GetNumScoreComponents(); - std::vector<float> inputScores(numInputScores); - std::copy(scoreVector.begin() - , scoreVector.begin() + numInputScores - , inputScores.begin()); - targetPhrase.GetScoreBreakdown().Assign(inputFeature, inputScores); - } + if (m_numInputScores) { + std::vector<float> inputScores(m_numInputScores); + std::copy(scoreVector.begin() + , scoreVector.begin() + m_numInputScores + , inputScores.begin()); + targetPhrase.GetScoreBreakdown().Assign(inputFeature, inputScores); } size_t numPtScores = m_obj->GetNumScoreComponents(); |