floor generation score

git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@969 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
hieuhoang1972 2006-11-09 17:55:59 +00:00
parent c140de307e
commit 0fd00c6649
4 changed files with 8 additions and 13 deletions

View File

@ -103,7 +103,7 @@ void GenerationDictionary::Load(const std::vector<FactorType> &input
}
std::vector<float> scores(numFeatureValuesInConfig, 0.0f);
for (size_t i = 0; i < numFeatureValuesInConfig; i++)
scores[i] = TransformScore(Scan<float>(token[2+i]));
scores[i] = FloorScore(TransformScore(Scan<float>(token[2+i])));
Collection::iterator iterWord = m_collection.find(inputWord);
if (iterWord == m_collection.end())

View File

@ -140,7 +140,7 @@ float LanguageModelInternal::GetValue(const Factor *factor0, State* finalState)
*finalState = static_cast<const void*>(nGram);
prob = nGram->GetScore();
}
return FloorSRIScore(prob);
return FloorScore(prob);
}
float LanguageModelInternal::GetValue(const Factor *factor0, const Factor *factor1, State* finalState) const
{
@ -180,7 +180,7 @@ float LanguageModelInternal::GetValue(const Factor *factor0, const Factor *facto
}
}
return FloorSRIScore(score);
return FloorScore(score);
}
@ -253,6 +253,6 @@ float LanguageModelInternal::GetValue(const Factor *factor0, const Factor *facto
}
}
return FloorSRIScore(score);
return FloorScore(score);
}

View File

@ -129,7 +129,7 @@ VocabIndex LanguageModelSRI::GetLmID( const Factor *factor ) const
float LanguageModelSRI::GetValue(VocabIndex wordId, VocabIndex *context) const
{
float p = m_srilmModel->wordProb( wordId, context );
return FloorSRIScore(TransformSRIScore(p)); // log10->log
return FloorScore(TransformSRIScore(p)); // log10->log
}
float LanguageModelSRI::GetValue(const vector<const Word*> &contextFactor, State* finalState, unsigned int *len) const

View File

@ -188,10 +188,10 @@ inline float UntransformIRSTScore(float logNScore)
return logNScore / 2.30258509299405f;
}
//! make sure LM score doesn't fall below LOWEST_SCORE
inline float FloorIRSTScore(float irstScore)
//! make sure score doesn't fall below LOWEST_SCORE
inline float FloorScore(float logScore)
{
return (std::max)(irstScore , LOWEST_SCORE);
return (std::max)(logScore , LOWEST_SCORE);
}
//! Should SRI & IRST transform functions be merged ???
@ -205,11 +205,6 @@ inline float UntransformSRIScore(float logNScore)
return logNScore / 2.30258509299405f;
}
inline float FloorSRIScore(float sriScore)
{
return (std::max)(sriScore, LOWEST_SCORE);
}
/** convert prob vector to log prob and calc inner product with weight vector.
* At least, that's what I think it does, fn is only 9 lines but can't figure out what it does.
* Not sure whether give zens a medal for being a genius, or shoot him for writing unreadable code. Mabe both...