diff --git a/moses/src/Dictionary.cpp b/moses/src/Dictionary.cpp index 3fd9c155d..df84e595b 100644 --- a/moses/src/Dictionary.cpp +++ b/moses/src/Dictionary.cpp @@ -4,8 +4,8 @@ size_t Dictionary::s_index = 0; -Dictionary::Dictionary(size_t noScoreComponent) - :m_noScoreComponent(noScoreComponent) +Dictionary::Dictionary(size_t numScoreComponent) + :m_numScoreComponent(numScoreComponent) ,m_index(s_index++) { } diff --git a/moses/src/Dictionary.h b/moses/src/Dictionary.h index 23135246c..d62da378b 100644 --- a/moses/src/Dictionary.h +++ b/moses/src/Dictionary.h @@ -30,12 +30,12 @@ class Dictionary protected: static size_t s_index; - const size_t m_noScoreComponent, m_index; + const size_t m_numScoreComponent, m_index; FactorMask m_inputFactors; FactorMask m_outputFactors; public: - Dictionary(size_t noScoreComponent); + Dictionary(size_t numScoreComponent); const FactorMask &GetFactorMask(FactorDirection direction) const { @@ -53,8 +53,6 @@ public: } virtual ~Dictionary(); - size_t GetNoScoreComponents() const { return m_noScoreComponent; } - size_t GetIndex() const { return m_index; diff --git a/moses/src/GenerationDictionary.cpp b/moses/src/GenerationDictionary.cpp index 70057a490..60a3e11bf 100755 --- a/moses/src/GenerationDictionary.cpp +++ b/moses/src/GenerationDictionary.cpp @@ -122,7 +122,7 @@ GenerationDictionary::~GenerationDictionary() size_t GenerationDictionary::GetNumScoreComponents() const { - return this->GetNoScoreComponents(); + return m_numScoreComponent; } const std::string GenerationDictionary::GetScoreProducerDescription() const diff --git a/moses/src/PhraseDictionary.cpp b/moses/src/PhraseDictionary.cpp index bb498994b..fe9879886 100644 --- a/moses/src/PhraseDictionary.cpp +++ b/moses/src/PhraseDictionary.cpp @@ -24,8 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "StaticData.h" #include "InputType.h" -PhraseDictionary::PhraseDictionary(size_t noScoreComponent) - : Dictionary(noScoreComponent),m_tableLimit(0) +PhraseDictionary::PhraseDictionary(size_t numScoreComponent) + : Dictionary(numScoreComponent),m_tableLimit(0) { const_cast(StaticData::Instance()->GetScoreIndexManager()).AddScoreProducer(this); } @@ -45,5 +45,5 @@ const std::string PhraseDictionary::GetScoreProducerDescription() const size_t PhraseDictionary::GetNumScoreComponents() const { - return this->GetNoScoreComponents(); + return m_numScoreComponent; } diff --git a/moses/src/PhraseDictionary.h b/moses/src/PhraseDictionary.h index 21658f3d3..1b78c5284 100644 --- a/moses/src/PhraseDictionary.h +++ b/moses/src/PhraseDictionary.h @@ -42,7 +42,7 @@ class PhraseDictionary : public Dictionary, public ScoreProducer std::string m_filename; // just for debugging purposes public: - PhraseDictionary(size_t noScoreComponent); + PhraseDictionary(size_t numScoreComponent); virtual ~PhraseDictionary(); DecodeType GetDecodeType() const { return Translate; } diff --git a/moses/src/PhraseDictionaryMemory.cpp b/moses/src/PhraseDictionaryMemory.cpp index 8e2489f75..a26b2ff44 100755 --- a/moses/src/PhraseDictionaryMemory.cpp +++ b/moses/src/PhraseDictionaryMemory.cpp @@ -88,11 +88,11 @@ void PhraseDictionaryMemory::Load(const std::vector &input phraseVector = Phrase::Parse(tokens[0], input, factorDelimiter); vector scoreVector = Tokenize(tokens[2]); - if (scoreVector.size() != m_noScoreComponent) { - TRACE_ERR("Size of scoreVector != number (" < &input , float weightWP ) { - if(m_noScoreComponent!=weight.size()) { + if(m_numScoreComponent!=weight.size()) { std::cerr<<"ERROR: mismatch of number of scaling factors: "<(token[2]); + size_t numScoreComponent = Scan(token[2]); // weights for this phrase dictionary - vector weight(noScoreComponent); - for (size_t currScore = 0 ; currScore < noScoreComponent ; currScore++) + vector weight(numScoreComponent); + for (size_t currScore = 0 ; currScore < numScoreComponent ; currScore++) weight[currScore] = weightAll[totalPrevNoScoreComponent + currScore]; - if(weight.size()!=noScoreComponent) + if(weight.size()!=numScoreComponent) { - std::cerr<<"ERROR: your phrase table has "<(m_parameter.GetParam("weight-i")[k])); - noScoreComponent+=m_numInputScores; + numScoreComponent+=m_numInputScores; } - assert(noScoreComponent==weight.size()); + assert(numScoreComponent==weight.size()); std::copy(weight.begin(),weight.end(),std::back_inserter(m_allWeights)); - totalPrevNoScoreComponent += noScoreComponent; + totalPrevNoScoreComponent += numScoreComponent; string phraseTableHash = GetMD5Hash(filePath); string hashFilePath = GetCachePath() + PROJECT_NAME + "--" @@ -626,7 +626,7 @@ void StaticData::LoadPhraseTables(bool filter filterPhrase = false; VERBOSE(2,"using standard phrase tables"); - PhraseDictionaryMemory *pd=new PhraseDictionaryMemory(noScoreComponent); + PhraseDictionaryMemory *pd=new PhraseDictionaryMemory(numScoreComponent); pd->Load(input , output , m_factorCollection @@ -644,7 +644,7 @@ void StaticData::LoadPhraseTables(bool filter else { TRACE_ERR("using binary phrase tables for idx "<Create(input,output,m_factorCollection,filePath,weight, maxTargetPhrase[index], GetAllLM(),