mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
Measure TimeOtherScore in Search instead of in Hypothesis
This commit is contained in:
parent
5fea16a9a6
commit
8729a2d47d
@ -148,9 +148,6 @@ EvaluateWhenApplied(float estimatedScore)
|
||||
{
|
||||
const StaticData &staticData = StaticData::Instance();
|
||||
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StartTimeOtherScore();
|
||||
}
|
||||
// some stateless score producers cache their values in the translation
|
||||
// option: add these here
|
||||
// language model scores for n-grams completely contained within a target
|
||||
@ -177,21 +174,12 @@ EvaluateWhenApplied(float estimatedScore)
|
||||
}
|
||||
}
|
||||
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StopTimeOtherScore();
|
||||
m_manager.GetSentenceStats().StartTimeEstimateScore();
|
||||
}
|
||||
|
||||
// FUTURE COST
|
||||
m_estimatedScore = estimatedScore;
|
||||
|
||||
// TOTAL
|
||||
m_futureScore = m_currScoreBreakdown.GetWeightedScore() + m_estimatedScore;
|
||||
if (m_prevHypo) m_futureScore += m_prevHypo->GetScore();
|
||||
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StopTimeEstimateScore();
|
||||
}
|
||||
}
|
||||
|
||||
const Hypothesis* Hypothesis::GetPrevHypo()const
|
||||
|
@ -117,7 +117,13 @@ void SearchCubePruning::Decode()
|
||||
|
||||
for(bmIter = accessor.begin(); bmIter != accessor.end(); ++bmIter) {
|
||||
// build the first hypotheses
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StartTimeOtherScore();
|
||||
}
|
||||
bmIter->second->InitializeEdges();
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StopTimeOtherScore();
|
||||
}
|
||||
m_manager.GetSentenceStats().StartTimeManageCubes();
|
||||
BCQueue.push(bmIter->second);
|
||||
m_manager.GetSentenceStats().StopTimeManageCubes();
|
||||
@ -137,7 +143,13 @@ void SearchCubePruning::Decode()
|
||||
m_manager.GetSentenceStats().AddPopped();
|
||||
}
|
||||
// push on stack and create successors
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StartTimeOtherScore();
|
||||
}
|
||||
bc->ProcessBestHypothesis();
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StopTimeOtherScore();
|
||||
}
|
||||
// if there are any hypothesis left in this specific container, add back to queue
|
||||
m_manager.GetSentenceStats().StartTimeManageCubes();
|
||||
if (!bc->Empty())
|
||||
@ -148,9 +160,15 @@ void SearchCubePruning::Decode()
|
||||
// ensure diversity, a minimum number of inserted hyps for each bitmap container;
|
||||
// NOTE: diversity doesn't ensure they aren't pruned at some later point
|
||||
if (Diversity > 0) {
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StartTimeOtherScore();
|
||||
}
|
||||
for(bmIter = accessor.begin(); bmIter != accessor.end(); ++bmIter) {
|
||||
bmIter->second->EnsureMinStackHyps(Diversity);
|
||||
}
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StopTimeOtherScore();
|
||||
}
|
||||
}
|
||||
|
||||
// the stack is pruned before processing (lazy pruning):
|
||||
|
@ -307,7 +307,24 @@ void SearchNormal::ExpandHypothesis(const Hypothesis &hypothesis,
|
||||
stats.StopTimeBuildHyp();
|
||||
}
|
||||
if (newHypo==NULL) return;
|
||||
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StartTimeOtherScore();
|
||||
}
|
||||
newHypo->EvaluateWhenApplied(estimatedScore);
|
||||
IFVERBOSE(2) {
|
||||
m_manager.GetSentenceStats().StopTimeOtherScore();
|
||||
|
||||
// TODO: these have been meaningless for a while.
|
||||
// At least since commit 67fb5c
|
||||
// should now be measured in SearchNormal.cpp:254 instead, around CalcFutureScore2()
|
||||
// CalcFutureScore2() also called in BackwardsEdge::Initialize().
|
||||
//
|
||||
// however, CalcFutureScore2() should be quick
|
||||
// since it uses dynamic programming results in SquareMatrix
|
||||
m_manager.GetSentenceStats().StartTimeEstimateScore();
|
||||
m_manager.GetSentenceStats().StopTimeEstimateScore();
|
||||
}
|
||||
} else
|
||||
// early discarding: check if hypothesis is too bad to build
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user