mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 23:10:31 +03:00
Consistent naming: m_futureScore --> m_estimatedScore
This commit is contained in:
parent
d0be56f8ab
commit
32e29d6b8a
@ -120,14 +120,14 @@ public:
|
|||||||
BackwardsEdge::BackwardsEdge(const BitmapContainer &prevBitmapContainer
|
BackwardsEdge::BackwardsEdge(const BitmapContainer &prevBitmapContainer
|
||||||
, BitmapContainer &parent
|
, BitmapContainer &parent
|
||||||
, const TranslationOptionList &translations
|
, const TranslationOptionList &translations
|
||||||
, const SquareMatrix &futureScores,
|
, const SquareMatrix &estimatedScores,
|
||||||
const InputType& itype,
|
const InputType& itype,
|
||||||
const bool deterministic)
|
const bool deterministic)
|
||||||
: m_initialized(false)
|
: m_initialized(false)
|
||||||
, m_prevBitmapContainer(prevBitmapContainer)
|
, m_prevBitmapContainer(prevBitmapContainer)
|
||||||
, m_parent(parent)
|
, m_parent(parent)
|
||||||
, m_translations(translations)
|
, m_translations(translations)
|
||||||
, m_futureScores(futureScores)
|
, m_estimatedScores(estimatedScores)
|
||||||
, m_seenPosition()
|
, m_seenPosition()
|
||||||
, m_deterministic(deterministic)
|
, m_deterministic(deterministic)
|
||||||
{
|
{
|
||||||
@ -209,7 +209,7 @@ BackwardsEdge::Initialize()
|
|||||||
|
|
||||||
const Bitmap &bm = m_hypotheses[0]->GetWordsBitmap();
|
const Bitmap &bm = m_hypotheses[0]->GetWordsBitmap();
|
||||||
const Range &newRange = m_translations.Get(0)->GetSourceWordsRange();
|
const Range &newRange = m_translations.Get(0)->GetSourceWordsRange();
|
||||||
m_futureScore = m_futureScores.CalcFutureScore2(bm, newRange.GetStartPos(), newRange.GetEndPos());
|
m_estimatedScore = m_estimatedScores.CalcEstimatedScore(bm, newRange.GetStartPos(), newRange.GetEndPos());
|
||||||
|
|
||||||
Hypothesis *expanded = CreateHypothesis(*m_hypotheses[0], *m_translations.Get(0));
|
Hypothesis *expanded = CreateHypothesis(*m_hypotheses[0], *m_translations.Get(0));
|
||||||
m_parent.Enqueue(0, 0, expanded, this);
|
m_parent.Enqueue(0, 0, expanded, this);
|
||||||
@ -228,7 +228,7 @@ Hypothesis *BackwardsEdge::CreateHypothesis(const Hypothesis &hypothesis, const
|
|||||||
IFVERBOSE(2) {
|
IFVERBOSE(2) {
|
||||||
hypothesis.GetManager().GetSentenceStats().StopTimeBuildHyp();
|
hypothesis.GetManager().GetSentenceStats().StopTimeBuildHyp();
|
||||||
}
|
}
|
||||||
newHypo->EvaluateWhenApplied(m_futureScore);
|
newHypo->EvaluateWhenApplied(m_estimatedScore);
|
||||||
|
|
||||||
return newHypo;
|
return newHypo;
|
||||||
}
|
}
|
||||||
|
@ -184,8 +184,8 @@ private:
|
|||||||
const BitmapContainer &m_prevBitmapContainer;
|
const BitmapContainer &m_prevBitmapContainer;
|
||||||
BitmapContainer &m_parent;
|
BitmapContainer &m_parent;
|
||||||
const TranslationOptionList &m_translations;
|
const TranslationOptionList &m_translations;
|
||||||
const SquareMatrix &m_futureScores;
|
const SquareMatrix &m_estimatedScores;
|
||||||
float m_futureScore;
|
float m_estimatedScore;
|
||||||
|
|
||||||
bool m_deterministic;
|
bool m_deterministic;
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ public:
|
|||||||
BackwardsEdge(const BitmapContainer &prevBitmapContainer
|
BackwardsEdge(const BitmapContainer &prevBitmapContainer
|
||||||
, BitmapContainer &parent
|
, BitmapContainer &parent
|
||||||
, const TranslationOptionList &translations
|
, const TranslationOptionList &translations
|
||||||
, const SquareMatrix &futureScores
|
, const SquareMatrix &estimatedScores
|
||||||
, const InputType& source
|
, const InputType& source
|
||||||
, const bool deterministic = false);
|
, const bool deterministic = false);
|
||||||
~BackwardsEdge();
|
~BackwardsEdge();
|
||||||
|
@ -170,7 +170,7 @@ EvaluateWhenApplied(const StatelessFeatureFunction& slff)
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Hypothesis::
|
Hypothesis::
|
||||||
EvaluateWhenApplied(float futureScore)
|
EvaluateWhenApplied(float estimatedScore)
|
||||||
{
|
{
|
||||||
IFVERBOSE(2) {
|
IFVERBOSE(2) {
|
||||||
m_manager.GetSentenceStats().StartTimeOtherScore();
|
m_manager.GetSentenceStats().StartTimeOtherScore();
|
||||||
@ -206,7 +206,7 @@ EvaluateWhenApplied(float futureScore)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FUTURE COST
|
// FUTURE COST
|
||||||
m_estimatedScore = futureScore;
|
m_estimatedScore = estimatedScore;
|
||||||
|
|
||||||
// TOTAL
|
// TOTAL
|
||||||
m_futureScore = m_currScoreBreakdown.GetWeightedScore() + m_estimatedScore;
|
m_futureScore = m_currScoreBreakdown.GetWeightedScore() + m_estimatedScore;
|
||||||
|
@ -119,7 +119,7 @@ public:
|
|||||||
return m_currTargetWordsRange.GetNumWordsCovered();
|
return m_currTargetWordsRange.GetNumWordsCovered();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvaluateWhenApplied(float futureScore);
|
void EvaluateWhenApplied(float estimatedScore);
|
||||||
|
|
||||||
int GetId()const {
|
int GetId()const {
|
||||||
return m_id;
|
return m_id;
|
||||||
|
@ -252,14 +252,14 @@ void HypothesisStackCubePruning::SetBitmapAccessor(const Bitmap &newBitmap
|
|||||||
, HypothesisStackCubePruning &stack
|
, HypothesisStackCubePruning &stack
|
||||||
, const Range &/*range*/
|
, const Range &/*range*/
|
||||||
, BitmapContainer &bitmapContainer
|
, BitmapContainer &bitmapContainer
|
||||||
, const SquareMatrix &futureScore
|
, const SquareMatrix &estimatedScores
|
||||||
, const TranslationOptionList &transOptList)
|
, const TranslationOptionList &transOptList)
|
||||||
{
|
{
|
||||||
BitmapContainer *bmContainer = AddBitmapContainer(newBitmap, stack);
|
BitmapContainer *bmContainer = AddBitmapContainer(newBitmap, stack);
|
||||||
BackwardsEdge *edge = new BackwardsEdge(bitmapContainer
|
BackwardsEdge *edge = new BackwardsEdge(bitmapContainer
|
||||||
, *bmContainer
|
, *bmContainer
|
||||||
, transOptList
|
, transOptList
|
||||||
, futureScore
|
, estimatedScores
|
||||||
, m_manager.GetSource()
|
, m_manager.GetSource()
|
||||||
, m_deterministic);
|
, m_deterministic);
|
||||||
bmContainer->AddBackwardsEdge(edge);
|
bmContainer->AddBackwardsEdge(edge);
|
||||||
|
@ -125,7 +125,7 @@ public:
|
|||||||
, HypothesisStackCubePruning &stack
|
, HypothesisStackCubePruning &stack
|
||||||
, const Range &range
|
, const Range &range
|
||||||
, BitmapContainer &bitmapContainer
|
, BitmapContainer &bitmapContainer
|
||||||
, const SquareMatrix &futureScore
|
, const SquareMatrix &estimatedScores
|
||||||
, const TranslationOptionList &transOptList);
|
, const TranslationOptionList &transOptList);
|
||||||
|
|
||||||
/** pruning, if too large.
|
/** pruning, if too large.
|
||||||
|
@ -237,13 +237,13 @@ CreateForwardTodos(Bitmap const& bitmap, Range const& range,
|
|||||||
size_t numCovered = newBitmap.GetNumWordsCovered();
|
size_t numCovered = newBitmap.GetNumWordsCovered();
|
||||||
const TranslationOptionList* transOptList;
|
const TranslationOptionList* transOptList;
|
||||||
transOptList = m_transOptColl.GetTranslationOptionList(range);
|
transOptList = m_transOptColl.GetTranslationOptionList(range);
|
||||||
const SquareMatrix &futureScore = m_transOptColl.GetFutureScore();
|
const SquareMatrix &estimatedScores = m_transOptColl.GetEstimatedScores();
|
||||||
|
|
||||||
if (transOptList && transOptList->size() > 0) {
|
if (transOptList && transOptList->size() > 0) {
|
||||||
HypothesisStackCubePruning& newStack
|
HypothesisStackCubePruning& newStack
|
||||||
= *static_cast<HypothesisStackCubePruning*>(m_hypoStackColl[numCovered]);
|
= *static_cast<HypothesisStackCubePruning*>(m_hypoStackColl[numCovered]);
|
||||||
newStack.SetBitmapAccessor(newBitmap, newStack, range, bitmapContainer,
|
newStack.SetBitmapAccessor(newBitmap, newStack, range, bitmapContainer,
|
||||||
futureScore, *transOptList);
|
estimatedScores, *transOptList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,14 +251,14 @@ ExpandAllHypotheses(const Hypothesis &hypothesis, size_t startPos, size_t endPos
|
|||||||
float expectedScore = 0.0f;
|
float expectedScore = 0.0f;
|
||||||
|
|
||||||
const Bitmap &sourceCompleted = hypothesis.GetWordsBitmap();
|
const Bitmap &sourceCompleted = hypothesis.GetWordsBitmap();
|
||||||
float futureScore = m_transOptColl.GetFutureScore().CalcFutureScore2( sourceCompleted, startPos, endPos );
|
float estimatedScore = m_transOptColl.GetEstimatedScores().CalcEstimatedScore( sourceCompleted, startPos, endPos );
|
||||||
|
|
||||||
if (m_options.search.UseEarlyDiscarding()) {
|
if (m_options.search.UseEarlyDiscarding()) {
|
||||||
// expected score is based on score of current hypothesis
|
// expected score is based on score of current hypothesis
|
||||||
expectedScore = hypothesis.GetScore();
|
expectedScore = hypothesis.GetScore();
|
||||||
|
|
||||||
// add new future score estimate
|
// add new future score estimate
|
||||||
expectedScore += futureScore;
|
expectedScore += estimatedScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop through all translation options
|
// loop through all translation options
|
||||||
@ -274,7 +274,7 @@ ExpandAllHypotheses(const Hypothesis &hypothesis, size_t startPos, size_t endPos
|
|||||||
TranslationOptionList::const_iterator iter;
|
TranslationOptionList::const_iterator iter;
|
||||||
for (iter = tol->begin() ; iter != tol->end() ; ++iter) {
|
for (iter = tol->begin() ; iter != tol->end() ; ++iter) {
|
||||||
const TranslationOption &transOpt = **iter;
|
const TranslationOption &transOpt = **iter;
|
||||||
ExpandHypothesis(hypothesis, transOpt, expectedScore, futureScore, nextBitmap);
|
ExpandHypothesis(hypothesis, transOpt, expectedScore, estimatedScore, nextBitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ ExpandAllHypotheses(const Hypothesis &hypothesis, size_t startPos, size_t endPos
|
|||||||
void SearchNormal::ExpandHypothesis(const Hypothesis &hypothesis,
|
void SearchNormal::ExpandHypothesis(const Hypothesis &hypothesis,
|
||||||
const TranslationOption &transOpt,
|
const TranslationOption &transOpt,
|
||||||
float expectedScore,
|
float expectedScore,
|
||||||
float futureScore,
|
float estimatedScore,
|
||||||
const Bitmap &bitmap)
|
const Bitmap &bitmap)
|
||||||
{
|
{
|
||||||
const StaticData &staticData = StaticData::Instance();
|
const StaticData &staticData = StaticData::Instance();
|
||||||
@ -307,7 +307,7 @@ void SearchNormal::ExpandHypothesis(const Hypothesis &hypothesis,
|
|||||||
stats.StopTimeBuildHyp();
|
stats.StopTimeBuildHyp();
|
||||||
}
|
}
|
||||||
if (newHypo==NULL) return;
|
if (newHypo==NULL) return;
|
||||||
newHypo->EvaluateWhenApplied(futureScore);
|
newHypo->EvaluateWhenApplied(estimatedScore);
|
||||||
} else
|
} else
|
||||||
// early discarding: check if hypothesis is too bad to build
|
// early discarding: check if hypothesis is too bad to build
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ protected:
|
|||||||
ExpandHypothesis(const Hypothesis &hypothesis,
|
ExpandHypothesis(const Hypothesis &hypothesis,
|
||||||
const TranslationOption &transOpt,
|
const TranslationOption &transOpt,
|
||||||
float expectedScore,
|
float expectedScore,
|
||||||
float futureScore,
|
float estimatedScore,
|
||||||
const Bitmap &bitmap);
|
const Bitmap &bitmap);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -45,11 +45,11 @@ void SquareMatrix::InitTriangle(float val)
|
|||||||
* /param bitmap coverage bitmap
|
* /param bitmap coverage bitmap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
float SquareMatrix::CalcFutureScore( Bitmap const &bitmap ) const
|
float SquareMatrix::CalcEstimatedScore( Bitmap const &bitmap ) const
|
||||||
{
|
{
|
||||||
const size_t notInGap= numeric_limits<size_t>::max();
|
const size_t notInGap= numeric_limits<size_t>::max();
|
||||||
size_t startGap = notInGap;
|
size_t startGap = notInGap;
|
||||||
float futureScore = 0.0f;
|
float estimatedScore = 0.0f;
|
||||||
for(size_t currPos = 0 ; currPos < bitmap.GetSize() ; currPos++) {
|
for(size_t currPos = 0 ; currPos < bitmap.GetSize() ; currPos++) {
|
||||||
// start of a new gap?
|
// start of a new gap?
|
||||||
if(bitmap.GetValue(currPos) == false && startGap == notInGap) {
|
if(bitmap.GetValue(currPos) == false && startGap == notInGap) {
|
||||||
@ -57,16 +57,16 @@ float SquareMatrix::CalcFutureScore( Bitmap const &bitmap ) const
|
|||||||
}
|
}
|
||||||
// end of a gap?
|
// end of a gap?
|
||||||
else if(bitmap.GetValue(currPos) == true && startGap != notInGap) {
|
else if(bitmap.GetValue(currPos) == true && startGap != notInGap) {
|
||||||
futureScore += GetScore(startGap, currPos - 1);
|
estimatedScore += GetScore(startGap, currPos - 1);
|
||||||
startGap = notInGap;
|
startGap = notInGap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// coverage ending with gap?
|
// coverage ending with gap?
|
||||||
if (startGap != notInGap) {
|
if (startGap != notInGap) {
|
||||||
futureScore += GetScore(startGap, bitmap.GetSize() - 1);
|
estimatedScore += GetScore(startGap, bitmap.GetSize() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return futureScore;
|
return estimatedScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,12 +84,12 @@ float SquareMatrix::CalcFutureScore( Bitmap const &bitmap ) const
|
|||||||
* /param endPos end of the span that is added to the coverage
|
* /param endPos end of the span that is added to the coverage
|
||||||
*/
|
*/
|
||||||
|
|
||||||
float SquareMatrix::CalcFutureScore2( Bitmap const &bitmap, size_t startPos, size_t endPos ) const
|
float SquareMatrix::CalcEstimatedScore( Bitmap const &bitmap, size_t startPos, size_t endPos ) const
|
||||||
{
|
{
|
||||||
const size_t notInGap= numeric_limits<size_t>::max();
|
const size_t notInGap= numeric_limits<size_t>::max();
|
||||||
float futureScore = 0.0f;
|
float estimatedScore = 0.0f;
|
||||||
size_t startGap = bitmap.GetFirstGapPos();
|
size_t startGap = bitmap.GetFirstGapPos();
|
||||||
if (startGap == NOT_FOUND) return futureScore; // everything filled
|
if (startGap == NOT_FOUND) return estimatedScore; // everything filled
|
||||||
|
|
||||||
// start loop at first gap
|
// start loop at first gap
|
||||||
size_t startLoop = startGap+1;
|
size_t startLoop = startGap+1;
|
||||||
@ -108,16 +108,16 @@ float SquareMatrix::CalcFutureScore2( Bitmap const &bitmap, size_t startPos, siz
|
|||||||
}
|
}
|
||||||
// end of a gap?
|
// end of a gap?
|
||||||
else if(startGap != notInGap && (bitmap.GetValue(currPos) == true || (startPos <= currPos && currPos <= endPos))) {
|
else if(startGap != notInGap && (bitmap.GetValue(currPos) == true || (startPos <= currPos && currPos <= endPos))) {
|
||||||
futureScore += GetScore(startGap, currPos - 1);
|
estimatedScore += GetScore(startGap, currPos - 1);
|
||||||
startGap = notInGap;
|
startGap = notInGap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// coverage ending with gap?
|
// coverage ending with gap?
|
||||||
if (lastCovered != bitmap.GetSize() - 1) {
|
if (lastCovered != bitmap.GetSize() - 1) {
|
||||||
futureScore += GetScore(lastCovered+1, bitmap.GetSize() - 1);
|
estimatedScore += GetScore(lastCovered+1, bitmap.GetSize() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return futureScore;
|
return estimatedScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
TO_STRING_BODY(SquareMatrix);
|
TO_STRING_BODY(SquareMatrix);
|
||||||
|
@ -65,8 +65,8 @@ public:
|
|||||||
inline void SetScore(size_t startPos, size_t endPos, float value) {
|
inline void SetScore(size_t startPos, size_t endPos, float value) {
|
||||||
m_array[startPos * m_size + endPos] = value;
|
m_array[startPos * m_size + endPos] = value;
|
||||||
}
|
}
|
||||||
float CalcFutureScore( Bitmap const& ) const;
|
float CalcEstimatedScore( Bitmap const& ) const;
|
||||||
float CalcFutureScore2( Bitmap const&, size_t startPos, size_t endPos ) const;
|
float CalcEstimatedScore( Bitmap const&, size_t startPos, size_t endPos ) const;
|
||||||
|
|
||||||
TO_STRING();
|
TO_STRING();
|
||||||
};
|
};
|
||||||
|
@ -62,7 +62,7 @@ TranslationOptionCollection(ttasksptr const& ttask,
|
|||||||
float translationOptionThreshold)
|
float translationOptionThreshold)
|
||||||
: m_ttask(ttask)
|
: m_ttask(ttask)
|
||||||
, m_source(src)
|
, m_source(src)
|
||||||
, m_futureScore(src.GetSize())
|
, m_estimatedScores(src.GetSize())
|
||||||
, m_maxNoTransOptPerCoverage(maxNoTransOptPerCoverage)
|
, m_maxNoTransOptPerCoverage(maxNoTransOptPerCoverage)
|
||||||
, m_translationOptionThreshold(translationOptionThreshold)
|
, m_translationOptionThreshold(translationOptionThreshold)
|
||||||
{
|
{
|
||||||
@ -254,10 +254,10 @@ ProcessOneUnknownWord(const InputPath &inputPath, size_t sourcePos,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
TranslationOptionCollection::
|
TranslationOptionCollection::
|
||||||
CalcFutureScore()
|
CalcEstimatedScore()
|
||||||
{
|
{
|
||||||
// setup the matrix (ignore lower triangle, set upper triangle to -inf
|
// setup the matrix (ignore lower triangle, set upper triangle to -inf
|
||||||
m_futureScore.InitTriangle(-numeric_limits<float>::infinity());
|
m_estimatedScores.InitTriangle(-numeric_limits<float>::infinity());
|
||||||
|
|
||||||
// walk all the translation options and record the cheapest option for each span
|
// walk all the translation options and record the cheapest option for each span
|
||||||
size_t size = m_source.GetSize(); // the width of the matrix
|
size_t size = m_source.GetSize(); // the width of the matrix
|
||||||
@ -268,8 +268,8 @@ CalcFutureScore()
|
|||||||
for(toi = tol.begin() ; toi != tol.end() ; ++toi) {
|
for(toi = tol.begin() ; toi != tol.end() ; ++toi) {
|
||||||
const TranslationOption& to = **toi;
|
const TranslationOption& to = **toi;
|
||||||
float score = to.GetFutureScore();
|
float score = to.GetFutureScore();
|
||||||
if (score > m_futureScore.GetScore(sPos, ePos))
|
if (score > m_estimatedScores.GetScore(sPos, ePos))
|
||||||
m_futureScore.SetScore(sPos, ePos, score);
|
m_estimatedScores.SetScore(sPos, ePos, score);
|
||||||
}
|
}
|
||||||
++ePos;
|
++ePos;
|
||||||
}
|
}
|
||||||
@ -287,8 +287,8 @@ CalcFutureScore()
|
|||||||
size_t sPos = diagshift;
|
size_t sPos = diagshift;
|
||||||
size_t ePos = colstart+diagshift;
|
size_t ePos = colstart+diagshift;
|
||||||
for(size_t joinAt = sPos; joinAt < ePos ; joinAt++) {
|
for(size_t joinAt = sPos; joinAt < ePos ; joinAt++) {
|
||||||
float joinedScore = m_futureScore.GetScore(sPos, joinAt)
|
float joinedScore = m_estimatedScores.GetScore(sPos, joinAt)
|
||||||
+ m_futureScore.GetScore(joinAt+1, ePos);
|
+ m_estimatedScores.GetScore(joinAt+1, ePos);
|
||||||
// uncomment to see the cell filling scheme
|
// uncomment to see the cell filling scheme
|
||||||
// TRACE_ERR("[" << sPos << "," << ePos << "] <-? ["
|
// TRACE_ERR("[" << sPos << "," << ePos << "] <-? ["
|
||||||
// << sPos << "," << joinAt << "]+["
|
// << sPos << "," << joinAt << "]+["
|
||||||
@ -296,8 +296,8 @@ CalcFutureScore()
|
|||||||
// << colstart << ", diagshift: " << diagshift << ")"
|
// << colstart << ", diagshift: " << diagshift << ")"
|
||||||
// << endl);
|
// << endl);
|
||||||
|
|
||||||
if (joinedScore > m_futureScore.GetScore(sPos, ePos))
|
if (joinedScore > m_estimatedScores.GetScore(sPos, ePos))
|
||||||
m_futureScore.SetScore(sPos, ePos, joinedScore);
|
m_estimatedScores.SetScore(sPos, ePos, joinedScore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,7 +325,7 @@ CalcFutureScore()
|
|||||||
for(size_t row=0; row<size; row++)
|
for(size_t row=0; row<size; row++)
|
||||||
for(size_t col=row; col<size; col++)
|
for(size_t col=row; col<size; col++)
|
||||||
TRACE_ERR( "future cost from "<< row <<" to "<< col <<" is "
|
TRACE_ERR( "future cost from "<< row <<" to "<< col <<" is "
|
||||||
<< m_futureScore.GetScore(row, col) <<endl);
|
<< m_estimatedScores.GetScore(row, col) <<endl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ CreateTranslationOptions()
|
|||||||
VERBOSE(3,"Translation Option Collection\n " << *this << endl);
|
VERBOSE(3,"Translation Option Collection\n " << *this << endl);
|
||||||
Prune();
|
Prune();
|
||||||
Sort();
|
Sort();
|
||||||
CalcFutureScore(); // future score matrix
|
CalcEstimatedScore(); // future score matrix
|
||||||
CacheLexReordering(); // Cached lex reodering costs
|
CacheLexReordering(); // Cached lex reodering costs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ protected:
|
|||||||
ttaskwptr m_ttask; // that is and must be a weak pointer!
|
ttaskwptr m_ttask; // that is and must be a weak pointer!
|
||||||
std::vector< std::vector< TranslationOptionList > > m_collection; /*< contains translation options */
|
std::vector< std::vector< TranslationOptionList > > m_collection; /*< contains translation options */
|
||||||
InputType const &m_source; /*< reference to the input */
|
InputType const &m_source; /*< reference to the input */
|
||||||
SquareMatrix m_futureScore; /*< matrix of future costs for contiguous parts (span) of the input */
|
SquareMatrix m_estimatedScores; /*< matrix of future costs for contiguous parts (span) of the input */
|
||||||
const size_t m_maxNoTransOptPerCoverage; /*< maximum number of translation options per input span */
|
const size_t m_maxNoTransOptPerCoverage; /*< maximum number of translation options per input span */
|
||||||
const float m_translationOptionThreshold; /*< threshold for translation options with regard to best option for input span */
|
const float m_translationOptionThreshold; /*< threshold for translation options with regard to best option for input span */
|
||||||
std::vector<const Phrase*> m_unksrcs;
|
std::vector<const Phrase*> m_unksrcs;
|
||||||
@ -78,7 +78,7 @@ protected:
|
|||||||
InputType const& src, size_t maxNoTransOptPerCoverage,
|
InputType const& src, size_t maxNoTransOptPerCoverage,
|
||||||
float translationOptionThreshold);
|
float translationOptionThreshold);
|
||||||
|
|
||||||
void CalcFutureScore();
|
void CalcEstimatedScore();
|
||||||
|
|
||||||
//! Force a creation of a translation option where there are none for a particular source position.
|
//! Force a creation of a translation option where there are none for a particular source position.
|
||||||
void ProcessUnknownWord();
|
void ProcessUnknownWord();
|
||||||
@ -163,8 +163,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//! returns future cost matrix for sentence
|
//! returns future cost matrix for sentence
|
||||||
inline virtual const SquareMatrix &GetFutureScore() const {
|
inline virtual const SquareMatrix &GetEstimatedScores() const {
|
||||||
return m_futureScore;
|
return m_estimatedScores;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! list of trans opt for a particular span
|
//! list of trans opt for a particular span
|
||||||
|
@ -168,7 +168,7 @@ void TranslationOptionCollectionLattice::CreateTranslationOptions()
|
|||||||
Sort();
|
Sort();
|
||||||
|
|
||||||
// future score matrix
|
// future score matrix
|
||||||
CalcFutureScore();
|
CalcEstimatedScore();
|
||||||
|
|
||||||
// Cached lex reodering costs
|
// Cached lex reodering costs
|
||||||
CacheLexReordering();
|
CacheLexReordering();
|
||||||
|
Loading…
Reference in New Issue
Block a user