mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-19 07:07:24 +03:00
get rid of id's in dictionary
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@48 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
1e9af4107a
commit
7b1113eea7
@ -53,7 +53,7 @@ Hypothesis::Hypothesis(const Hypothesis ©)
|
|||||||
SetScore(copy.GetScore());
|
SetScore(copy.GetScore());
|
||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
m_lmScoreComponent = copy.GetLMScoreComponent();
|
m_lmScoreComponent = copy.GetLMScoreComponent();
|
||||||
m_ScoreComponent = copy.GetScoreComponent();
|
m_transScoreComponent = copy.GetScoreComponent();
|
||||||
m_generationScoreComponent = copy.GetGenerationScoreComponent();
|
m_generationScoreComponent = copy.GetGenerationScoreComponent();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -95,11 +95,11 @@ Hypothesis::Hypothesis(const Hypothesis &prevHypo, const TranslationOption &tran
|
|||||||
|
|
||||||
// translation score
|
// translation score
|
||||||
const ScoreComponentCollection &prevComponent= prevHypo.GetScoreComponent();
|
const ScoreComponentCollection &prevComponent= prevHypo.GetScoreComponent();
|
||||||
m_ScoreComponent = prevComponent;
|
m_transScoreComponent = prevComponent;
|
||||||
|
|
||||||
// add components specific to poss trans
|
// add components specific to poss trans
|
||||||
const ScoreComponent &possComponent = transOpt.GetScoreComponents();
|
const ScoreComponent &possComponent = transOpt.GetScoreComponents();
|
||||||
ScoreComponent &transComponent = m_ScoreComponent.GetScoreComponent(possComponent.GetPhraseDictionary());
|
ScoreComponent &transComponent = m_transScoreComponent.GetScoreComponent(possComponent.GetPhraseDictionary());
|
||||||
const size_t noScoreComponent = possComponent.GetNoScoreComponent();
|
const size_t noScoreComponent = possComponent.GetNoScoreComponent();
|
||||||
|
|
||||||
for (size_t i = 0 ; i < noScoreComponent ; i++)
|
for (size_t i = 0 ; i < noScoreComponent ; i++)
|
||||||
@ -152,7 +152,7 @@ Hypothesis *Hypothesis::MergeNext(const TranslationOption &transOpt) const
|
|||||||
|
|
||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
const ScoreComponent &transOptComponent = transOpt.GetScoreComponents();
|
const ScoreComponent &transOptComponent = transOpt.GetScoreComponents();
|
||||||
clone->m_ScoreComponent.Add(transOptComponent);
|
clone->m_transScoreComponent.Add(transOptComponent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return clone;
|
return clone;
|
||||||
|
@ -53,7 +53,7 @@ void LatticeEdge::ResizeComponentScore(const LMList &allLM, const list < DecodeS
|
|||||||
{
|
{
|
||||||
case Translate:
|
case Translate:
|
||||||
{
|
{
|
||||||
ScoreComponent &transScoreComponent = m_ScoreComponent.Add(&step.GetPhraseDictionary());
|
ScoreComponent &transScoreComponent = m_transScoreComponent.Add(&step.GetPhraseDictionary());
|
||||||
transScoreComponent.Reset();
|
transScoreComponent.Reset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ protected:
|
|||||||
Phrase m_phrase;
|
Phrase m_phrase;
|
||||||
|
|
||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
ScoreComponentCollection m_ScoreComponent;
|
ScoreComponentCollection m_transScoreComponent;
|
||||||
ScoreColl m_generationScoreComponent
|
ScoreColl m_generationScoreComponent
|
||||||
,m_lmScoreComponent;
|
,m_lmScoreComponent;
|
||||||
#endif
|
#endif
|
||||||
@ -63,7 +63,7 @@ public:
|
|||||||
:m_prevHypo(prevHypo)
|
:m_prevHypo(prevHypo)
|
||||||
,m_phrase(phrase)
|
,m_phrase(phrase)
|
||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
,m_ScoreComponent(transScoreComponent)
|
,m_transScoreComponent(transScoreComponent)
|
||||||
,m_generationScoreComponent(generationScoreComponent)
|
,m_generationScoreComponent(generationScoreComponent)
|
||||||
,m_lmScoreComponent (lmScoreComponent)
|
,m_lmScoreComponent (lmScoreComponent)
|
||||||
#endif
|
#endif
|
||||||
@ -114,7 +114,7 @@ public:
|
|||||||
|
|
||||||
inline const ScoreComponentCollection &GetScoreComponent() const
|
inline const ScoreComponentCollection &GetScoreComponent() const
|
||||||
{
|
{
|
||||||
return m_ScoreComponent;
|
return m_transScoreComponent;
|
||||||
}
|
}
|
||||||
inline const ScoreColl &GetLMScoreComponent() const
|
inline const ScoreColl &GetLMScoreComponent() const
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,7 @@ LatticePath::LatticePath(const Hypothesis *hypo)
|
|||||||
}
|
}
|
||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
m_lmScoreComponent = hypo->GetLMScoreComponent();
|
m_lmScoreComponent = hypo->GetLMScoreComponent();
|
||||||
m_ScoreComponent = hypo->GetScoreComponent();
|
m_transScoreComponent = hypo->GetScoreComponent();
|
||||||
m_generationScoreComponent = hypo->GetGenerationScoreComponent();
|
m_generationScoreComponent = hypo->GetGenerationScoreComponent();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ void LatticePath::CalcScore(const LatticePath ©, size_t edgeIndex, const Arc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// phrase trans
|
// phrase trans
|
||||||
m_ScoreComponent = copy.GetScoreComponent();
|
m_transScoreComponent = copy.GetScoreComponent();
|
||||||
|
|
||||||
const ScoreComponentCollection
|
const ScoreComponentCollection
|
||||||
&arcComponent = arc->GetScoreComponent()
|
&arcComponent = arc->GetScoreComponent()
|
||||||
@ -112,7 +112,7 @@ void LatticePath::CalcScore(const LatticePath ©, size_t edgeIndex, const Arc
|
|||||||
,&totalComponent= copy.GetScoreComponent();
|
,&totalComponent= copy.GetScoreComponent();
|
||||||
|
|
||||||
ScoreComponentCollection::iterator iterTrans;
|
ScoreComponentCollection::iterator iterTrans;
|
||||||
for (iterTrans = m_ScoreComponent.begin() ; iterTrans != m_ScoreComponent.end() ; ++iterTrans)
|
for (iterTrans = m_transScoreComponent.begin() ; iterTrans != m_transScoreComponent.end() ; ++iterTrans)
|
||||||
{
|
{
|
||||||
const PhraseDictionary *phraseDictionary = iterTrans->first;
|
const PhraseDictionary *phraseDictionary = iterTrans->first;
|
||||||
ScoreComponent &transScore = *iterTrans->second;
|
ScoreComponent &transScore = *iterTrans->second;
|
||||||
|
@ -42,7 +42,7 @@ protected:
|
|||||||
size_t m_prevEdgeChanged;
|
size_t m_prevEdgeChanged;
|
||||||
float m_score[NUM_SCORES];
|
float m_score[NUM_SCORES];
|
||||||
|
|
||||||
ScoreComponentCollection m_ScoreComponent;
|
ScoreComponentCollection m_transScoreComponent;
|
||||||
ScoreColl m_generationScoreComponent
|
ScoreColl m_generationScoreComponent
|
||||||
, m_lmScoreComponent;
|
, m_lmScoreComponent;
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ public:
|
|||||||
}
|
}
|
||||||
inline const ScoreComponentCollection &GetScoreComponent() const
|
inline const ScoreComponentCollection &GetScoreComponent() const
|
||||||
{
|
{
|
||||||
return m_ScoreComponent;
|
return m_transScoreComponent;
|
||||||
}
|
}
|
||||||
inline const ScoreColl &GetGenerationScoreComponent() const
|
inline const ScoreColl &GetGenerationScoreComponent() const
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ TranslationOption::TranslationOption(const WordsRange &wordsRange
|
|||||||
,m_futureScore (0)
|
,m_futureScore (0)
|
||||||
,m_ngramScore(0)
|
,m_ngramScore(0)
|
||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
,m_ScoreComponent(targetPhrase.GetScoreComponents())
|
,m_transScoreComponent(targetPhrase.GetScoreComponents())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ TranslationOption::TranslationOption(const WordsRange &wordsRange
|
|||||||
,m_wordsRange (wordsRange)
|
,m_wordsRange (wordsRange)
|
||||||
,m_transScore (transScore)
|
,m_transScore (transScore)
|
||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
,m_ScoreComponent(targetPhrase.GetScoreComponents())
|
,m_transScoreComponent(targetPhrase.GetScoreComponents())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
CalcFutureScore(lmList, weightWP);
|
CalcFutureScore(lmList, weightWP);
|
||||||
|
@ -37,7 +37,7 @@ protected:
|
|||||||
WordsRange m_wordsRange;
|
WordsRange m_wordsRange;
|
||||||
float m_transScore, m_futureScore, m_ngramScore;
|
float m_transScore, m_futureScore, m_ngramScore;
|
||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
ScoreComponent m_ScoreComponent;
|
ScoreComponent m_transScoreComponent;
|
||||||
std::list< std::pair<size_t, float> > m_lmScoreComponent;
|
std::list< std::pair<size_t, float> > m_lmScoreComponent;
|
||||||
std::list< std::pair<size_t, float> > m_trigramComponent;
|
std::list< std::pair<size_t, float> > m_trigramComponent;
|
||||||
#endif
|
#endif
|
||||||
@ -91,7 +91,7 @@ public:
|
|||||||
#ifdef N_BEST
|
#ifdef N_BEST
|
||||||
inline const ScoreComponent &GetScoreComponents() const
|
inline const ScoreComponent &GetScoreComponents() const
|
||||||
{
|
{
|
||||||
return m_ScoreComponent;
|
return m_transScoreComponent;
|
||||||
}
|
}
|
||||||
inline const std::list< std::pair<size_t, float> > &GetLMScoreComponent() const
|
inline const std::list< std::pair<size_t, float> > &GetLMScoreComponent() const
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user