diff options
author | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2007-10-31 20:59:58 +0300 |
---|---|---|
committer | hieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230> | 2007-10-31 20:59:58 +0300 |
commit | d99aea83f5bd83f15a0102afaee52e64409a125c (patch) | |
tree | 712510a4de92d1b02bc2bb989560b10329328cea /moses | |
parent | 568f92b310e6a252f5ad6f53d96c66f6a8b857ac (diff) |
cleanup scoring in TranslationOption
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1494 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses')
-rwxr-xr-x | moses/src/TranslationOption.cpp | 14 | ||||
-rwxr-xr-x | moses/src/TranslationOption.h | 4 |
2 files changed, 6 insertions, 12 deletions
diff --git a/moses/src/TranslationOption.cpp b/moses/src/TranslationOption.cpp index 374907b74..0cab5c1f8 100755 --- a/moses/src/TranslationOption.cpp +++ b/moses/src/TranslationOption.cpp @@ -82,9 +82,7 @@ TranslationOption::TranslationOption(const TranslationOption ©) //, m_sourcePhrase(new Phrase(*copy.m_sourcePhrase)) // TODO use when confusion network trans opt for confusion net properly implemented , m_sourcePhrase( (copy.m_sourcePhrase == NULL) ? new Phrase(Input) : new Phrase(*copy.m_sourcePhrase)) , m_sourceWordsRange(copy.m_sourceWordsRange) -, m_totalScore(copy.m_totalScore) , m_futureScore(copy.m_futureScore) -, m_partialScore(copy.m_partialScore) , m_scoreBreakdown(copy.m_scoreBreakdown) , m_reordering(copy.m_reordering) {} @@ -94,9 +92,7 @@ TranslationOption::TranslationOption(const TranslationOption ©, const WordsR //, m_sourcePhrase(new Phrase(*copy.m_sourcePhrase)) // TODO use when confusion network trans opt for confusion net properly implemented , m_sourcePhrase( (copy.m_sourcePhrase == NULL) ? new Phrase(Input) : new Phrase(*copy.m_sourcePhrase)) , m_sourceWordsRange(sourceWordsRange) -, m_totalScore(copy.m_totalScore) , m_futureScore(copy.m_futureScore) -, m_partialScore(copy.m_partialScore) , m_scoreBreakdown(copy.m_scoreBreakdown) , m_reordering(copy.m_reordering) {} @@ -135,17 +131,17 @@ bool TranslationOption::Overlap(const Hypothesis &hypothesis) const void TranslationOption::CalcScore() { // LM scores - float m_ngramScore = 0; + float ngramScore = 0; float retFullScore = 0; const LMList &allLM = StaticData::Instance().GetAllLM(); - allLM.CalcScore(GetTargetPhrase(), retFullScore, m_ngramScore, &m_scoreBreakdown); - // future score - m_futureScore = retFullScore - m_ngramScore; + allLM.CalcScore(GetTargetPhrase(), retFullScore, ngramScore, &m_scoreBreakdown); size_t phraseSize = GetTargetPhrase().GetSize(); - m_futureScore += m_scoreBreakdown.InnerProduct(StaticData::Instance().GetAllWeights()) - phraseSize * StaticData::Instance().GetWeightWordPenalty(); + // future score + m_futureScore = retFullScore - ngramScore + + m_scoreBreakdown.InnerProduct(StaticData::Instance().GetAllWeights()) - phraseSize * StaticData::Instance().GetWeightWordPenalty(); } TO_STRING_BODY(TranslationOption); diff --git a/moses/src/TranslationOption.h b/moses/src/TranslationOption.h index a26b3d7a1..441cd403c 100755 --- a/moses/src/TranslationOption.h +++ b/moses/src/TranslationOption.h @@ -59,10 +59,8 @@ protected: Phrase m_targetPhrase; /*< output phrase when using this translation option */ Phrase *m_sourcePhrase; /*< input phrase translated by this */ const WordsRange m_sourceWordsRange; /*< word position in the input that are covered by this translation option */ - float m_totalScore; /*< weighted translation costs of this translation option */ float m_futureScore; /*< estimate of total cost when using this translation option, includes language model probabilities */ - float m_partialScore; /*< estimate of the partial cost of a preliminary translation option */ - + //! in TranslationOption, m_scoreBreakdown is not complete. It cannot, //! for example, know the full n-gram score since the length of the //! TargetPhrase may be shorter than the n-gram order. But, if it is |