mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 21:42:19 +03:00
clean.
This commit is contained in:
parent
39799188a0
commit
832b725c59
@ -340,8 +340,6 @@ FFState *LanguageModelDALM::EvaluateWhenApplied(const Hypothesis &hypo, const FF
|
||||
}
|
||||
|
||||
FFState *LanguageModelDALM::EvaluateWhenApplied(const ChartHypothesis& hypo, int featureID, ScoreComponentCollection *out) const{
|
||||
// TODO: original authors of this feature function, please check TODOs in this method to reactivate
|
||||
//UTIL_THROW2("DALM has been temporarily deactivated in the chart decoder, cf. http://thread.gmane.org/gmane.comp.nlp.moses.user/12146");
|
||||
// initialize language model context state
|
||||
DALMChartState *newState = new DALMChartState();
|
||||
DALM::State &state = newState->GetRightContext();
|
||||
@ -382,9 +380,6 @@ FFState *LanguageModelDALM::EvaluateWhenApplied(const ChartHypothesis& hypo, int
|
||||
(*newState) = (*prevState);
|
||||
hypoSizeAll = hypoSize+prevState->GetHypoSize()-1;
|
||||
|
||||
// get hypoScore
|
||||
// hypoScore = UntransformLMScore(prevHypo->GetScoreBreakdown().GetScoresForProducer(this)[0]); // TODO: Check whether this (and the below) modification is sufficient to fix the method to conform with feature score deltas in the chart decoder: https://github.com/moses-smt/mosesdecoder/commit/465b47566424efb707bdc063d0bff52b0650eb0a . It's likely that you'll also have to adapt EvaluateNonTerminal() and/or EvaluateTerminal()
|
||||
|
||||
phrasePos++;
|
||||
}
|
||||
}
|
||||
@ -412,21 +407,19 @@ FFState *LanguageModelDALM::EvaluateWhenApplied(const ChartHypothesis& hypo, int
|
||||
const DALMChartState* prevState =
|
||||
static_cast<const DALMChartState*>(prevHypo->GetFFState(featureID));
|
||||
size_t prevTargetPhraseLength = prevHypo->GetCurrTargetPhrase().GetSize();
|
||||
//float prevHypoScore = UntransformLMScore(prevHypo->GetScoreBreakdown().GetScoresForProducer(this)[0]);
|
||||
hypoSizeAll += prevState->GetHypoSize()-1;
|
||||
|
||||
EvaluateNonTerminal(
|
||||
word, hypoScore,
|
||||
newState, state,
|
||||
prefixFragments, prefixLength,
|
||||
prevState, prevTargetPhraseLength //, prevHypoScore
|
||||
prevState, prevTargetPhraseLength
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// assign combined score to score breakdown
|
||||
// out->Assign(this, TransformLMScore(hypoScore));
|
||||
out->PlusEquals(this, TransformLMScore(hypoScore)); // TODO: Check whether this (and the above) modification is sufficient to fix the method to conform with feature score deltas in the chart decoder: https://github.com/moses-smt/mosesdecoder/commit/465b47566424efb707bdc063d0bff52b0650eb0a . It's likely that you'll also have to adapt EvaluateNonTerminal() and/or EvaluateTerminal()
|
||||
out->PlusEquals(this, TransformLMScore(hypoScore));
|
||||
|
||||
return newState;
|
||||
}
|
||||
@ -525,12 +518,10 @@ void LanguageModelDALM::EvaluateNonTerminal(
|
||||
unsigned char &prefixLength,
|
||||
const DALMChartState *prevState,
|
||||
size_t prevTargetPhraseLength
|
||||
//float prevHypoScore
|
||||
) const{
|
||||
|
||||
const unsigned char prevPrefixLength = prevState->GetPrefixLength();
|
||||
const DALM::Fragment *prevPrefixFragments = prevState->GetPrefixFragments();
|
||||
//hypoScore += prevHypoScore;
|
||||
|
||||
if(prevPrefixLength == 0){
|
||||
newState->SetAsLarge();
|
||||
|
@ -95,7 +95,6 @@ private:
|
||||
unsigned char &prefixLength,
|
||||
const DALMChartState *prevState,
|
||||
size_t prevTargetPhraseLength
|
||||
//float prevHypoScore
|
||||
) const;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user