variable number of translation component scores

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@9 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
hieuhoang1972 2006-07-08 00:28:51 +00:00
parent 1138c0c0f7
commit 7a79e349a2
7 changed files with 35 additions and 9 deletions

27
moses/src/DecodeStep.h Normal file
View File

@ -0,0 +1,27 @@
#pragma once
#include "TypeDef.h"
class DecodeStep
{
protected:
DecodeType m_decodeType;
int m_id;
// 2nd = pointer to a phraseDictionary or generationDictionary
public:
DecodeStep(DecodeType decodeType, int id)
:m_decodeType(decodeType)
,m_id(id)
{
}
DecodeType GetDecodeType() const
{
return m_decodeType;
}
int GetId() const
{
return m_id;
}
};

View File

@ -49,17 +49,17 @@ void LatticeEdge::ResizeComponentScore(const LMList &allLM, const list < DecodeS
for (iterDecodeStep = decodeStepList.begin() ; iterDecodeStep != decodeStepList.end() ; ++iterDecodeStep)
{
const DecodeStep &step = *iterDecodeStep;
switch (step.first)
switch (step.GetDecodeType())
{
case Translate:
{
TransScoreComponent &transScoreComponent = m_transScoreComponent.Add(step.second);
TransScoreComponent &transScoreComponent = m_transScoreComponent.Add(step.GetId());
transScoreComponent.Reset();
break;
}
case Generate:
{
m_generationScoreComponent[step.second] = 0.0f;
m_generationScoreComponent[step.GetId()] = 0.0f;
break;
}
}

View File

@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "TransScoreComponent.h"
#include "TransScoreComponentCollection.h"
#include "ScoreColl.h"
#include "DecodeStep.h"
class Hypothesis;
class Arc;

View File

@ -136,7 +136,7 @@ void Manager::ProcessOneHypothesis(const list < DecodeStep > &decodeStepList
,&outputHypoColl = outputHypoCollVec[indexStep + 1];
// is it translation or generation
switch (decodeStep.first)
switch (decodeStep.GetDecodeType())
{
case Translate:
{

View File

@ -361,4 +361,3 @@ void StaticData::LoadMapping()
}
}

View File

@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "Parameter.h"
#include "LanguageModel.h"
#include "InputOutput.h"
#include "DecodeStep.h"
class StaticData
{
@ -97,11 +98,11 @@ public:
const PhraseDictionary &GetPhraseDictionary(const DecodeStep &decodeStep) const
{
return *m_phraseDictionary[decodeStep.second];
return *m_phraseDictionary[decodeStep.GetId()];
}
const GenerationDictionary &GetGenerationDictionary(const DecodeStep &decodeStep) const
{
return *m_generationDictionary[decodeStep.second];
return *m_generationDictionary[decodeStep.GetId()];
}
const LMList &GetLanguageModel(LMListType type) const
{

View File

@ -131,5 +131,3 @@ typedef const Factor * FactorArray[NUM_FACTORS];
class LanguageModel;
typedef std::list < LanguageModel* > LMList;
typedef std::pair < DecodeType , int > DecodeStep;
// 2nd = pointer to a phraseDictionary or generationDictionary