mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
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:
parent
1138c0c0f7
commit
7a79e349a2
27
moses/src/DecodeStep.h
Normal file
27
moses/src/DecodeStep.h
Normal 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;
|
||||
}
|
||||
|
||||
};
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
{
|
||||
|
@ -361,4 +361,3 @@ void StaticData::LoadMapping()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user