mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-10-06 16:27:32 +03:00
code cleanup
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@579 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
099ed1b113
commit
b403c8c784
@ -99,18 +99,20 @@ bool TranslationOption::Overlap(const Hypothesis &hypothesis) const
|
||||
return bitmap.Overlap(GetSourceWordsRange());
|
||||
}
|
||||
|
||||
void TranslationOption::CalcScore(const LMList &allLM, float weightWordPenalty)
|
||||
void TranslationOption::CalcScore()
|
||||
{
|
||||
// LM scores
|
||||
float m_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;
|
||||
|
||||
size_t phraseSize = GetTargetPhrase().GetSize();
|
||||
m_futureScore += m_scoreBreakdown.InnerProduct(StaticData::Instance()->GetAllWeights()) - phraseSize * weightWordPenalty;
|
||||
m_futureScore += m_scoreBreakdown.InnerProduct(StaticData::Instance()->GetAllWeights()) - phraseSize * StaticData::Instance()->GetWeightWordPenalty();
|
||||
}
|
||||
|
||||
TO_STRING_BODY(TranslationOption);
|
||||
|
@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include "Util.h"
|
||||
#include "TypeDef.h"
|
||||
#include "ScoreComponentCollection.h"
|
||||
#include "StaticData.h"
|
||||
|
||||
class PhraseDictionaryBase;
|
||||
class GenerationDictionary;
|
||||
@ -60,6 +61,7 @@ protected:
|
||||
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
|
||||
@ -141,7 +143,6 @@ public:
|
||||
{
|
||||
return m_targetPhrase.GetSize() == 0;
|
||||
}
|
||||
void CalcScore(const LMList &allLM, float weightWordPenalty);
|
||||
|
||||
/** returns detailed component scores */
|
||||
inline const ScoreComponentCollection2 &GetScoreBreakdown() const
|
||||
@ -149,6 +150,8 @@ public:
|
||||
return m_scoreBreakdown;
|
||||
}
|
||||
|
||||
void CalcScore();
|
||||
|
||||
TO_STRING;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user