consistent variable names

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@898 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
hieuhoang1972 2006-10-17 23:36:43 +00:00
parent 3e79119d59
commit 69d378e67d
12 changed files with 32 additions and 34 deletions

View File

@ -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++)
{
}

View File

@ -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;

View File

@ -122,7 +122,7 @@ GenerationDictionary::~GenerationDictionary()
size_t GenerationDictionary::GetNumScoreComponents() const
{
return this->GetNoScoreComponents();
return m_numScoreComponent;
}
const std::string GenerationDictionary::GetScoreProducerDescription() const

View File

@ -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<ScoreIndexManager&>(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;
}

View File

@ -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; }

View File

@ -88,11 +88,11 @@ void PhraseDictionaryMemory::Load(const std::vector<FactorType> &input
phraseVector = Phrase::Parse(tokens[0], input, factorDelimiter);
vector<float> scoreVector = Tokenize<float>(tokens[2]);
if (scoreVector.size() != m_noScoreComponent) {
TRACE_ERR("Size of scoreVector != number (" <<scoreVector.size() << "!=" <<m_noScoreComponent<<") of score components on line " << line_num);
if (scoreVector.size() != m_numScoreComponent) {
TRACE_ERR("Size of scoreVector != number (" <<scoreVector.size() << "!=" <<m_numScoreComponent<<") of score components on line " << line_num);
abort();
}
// assert(scoreVector.size() == m_noScoreComponent);
// assert(scoreVector.size() == m_numScoreComponent);
// source
Phrase sourcePhrase(Input);

View File

@ -44,8 +44,8 @@ protected:
TargetPhraseCollection *CreateTargetPhraseCollection(const Phrase &source);
public:
PhraseDictionaryMemory(size_t noScoreComponent)
: MyBase(noScoreComponent)
PhraseDictionaryMemory(size_t numScoreComponent)
: MyBase(numScoreComponent)
{
}
virtual ~PhraseDictionaryMemory();

View File

@ -274,8 +274,8 @@ void PDTimp::PrintTgtCand(const TgtCands& tcand,std::ostream& out) const
//
////////////////////////////////////////////////////////////
PhraseDictionaryTree::PhraseDictionaryTree(size_t noScoreComponent)
: Dictionary(noScoreComponent),imp(new PDTimp)
PhraseDictionaryTree::PhraseDictionaryTree(size_t numScoreComponent)
: Dictionary(numScoreComponent),imp(new PDTimp)
{
if(sizeof(off_t)!=8)
{

View File

@ -24,7 +24,7 @@ class PhraseDictionaryTree : public Dictionary {
PhraseDictionaryTree(const PhraseDictionaryTree&); //not implemented
void operator=(const PhraseDictionaryTree&); //not implemented
public:
PhraseDictionaryTree(size_t noScoreComponent);
PhraseDictionaryTree(size_t numScoreComponent);
virtual ~PhraseDictionaryTree();

View File

@ -20,8 +20,8 @@
*************************************************************/
PhraseDictionaryTreeAdaptor::
PhraseDictionaryTreeAdaptor(size_t noScoreComponent,unsigned numInputScores)
: MyBase(noScoreComponent),imp(new PDTAimp(this,numInputScores)) {}
PhraseDictionaryTreeAdaptor(size_t numScoreComponent,unsigned numInputScores)
: MyBase(numScoreComponent),imp(new PDTAimp(this,numInputScores)) {}
PhraseDictionaryTreeAdaptor::~PhraseDictionaryTreeAdaptor()
{
@ -54,9 +54,9 @@ void PhraseDictionaryTreeAdaptor::Create(const std::vector<FactorType> &input
, float weightWP
)
{
if(m_noScoreComponent!=weight.size()) {
if(m_numScoreComponent!=weight.size()) {
std::cerr<<"ERROR: mismatch of number of scaling factors: "<<weight.size()
<<" "<<m_noScoreComponent<<"\n";
<<" "<<m_numScoreComponent<<"\n";
abort();
}
m_filename = filePath;

View File

@ -24,7 +24,7 @@ class PhraseDictionaryTreeAdaptor : public PhraseDictionary {
void operator=(const PhraseDictionaryTreeAdaptor&);
public:
PhraseDictionaryTreeAdaptor(size_t noScoreComponent,unsigned numInputScores);
PhraseDictionaryTreeAdaptor(size_t numScoreComponent,unsigned numInputScores);
virtual ~PhraseDictionaryTreeAdaptor();
// enable/disable caching

View File

@ -566,15 +566,15 @@ void StaticData::LoadPhraseTables(bool filter
m_maxFactorIdx[1] = CalcMax(m_maxFactorIdx[1], output);
m_maxNumFactors = std::max(m_maxFactorIdx[0], m_maxFactorIdx[1]) + 1;
string filePath= token[3];
size_t noScoreComponent = Scan<size_t>(token[2]);
size_t numScoreComponent = Scan<size_t>(token[2]);
// weights for this phrase dictionary
vector<float> weight(noScoreComponent);
for (size_t currScore = 0 ; currScore < noScoreComponent ; currScore++)
vector<float> 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 "<<noScoreComponent<<" scores, but you specified "<<weight.size()<<" weights!\n";
std::cerr<<"ERROR: your phrase table has "<<numScoreComponent<<" scores, but you specified "<<weight.size()<<" weights!\n";
abort();
}
@ -584,14 +584,14 @@ void StaticData::LoadPhraseTables(bool filter
for(unsigned k=0;k<m_numInputScores;++k)
weight.push_back(Scan<float>(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 "<<currDict<<"\n");
PhraseDictionaryTreeAdaptor *pd=new PhraseDictionaryTreeAdaptor(noScoreComponent,(currDict==0 ? m_numInputScores : 0));
PhraseDictionaryTreeAdaptor *pd=new PhraseDictionaryTreeAdaptor(numScoreComponent,(currDict==0 ? m_numInputScores : 0));
pd->Create(input,output,m_factorCollection,filePath,weight,
maxTargetPhrase[index],
GetAllLM(),