mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
figure out which feature function to apply at which decode step. Book-keeping
This commit is contained in:
parent
7279164c8a
commit
f9d6528088
@ -903,7 +903,6 @@ bool StaticData::LoadDecodeGraphs()
|
||||
|
||||
m_decodeGraphs.push_back(decodeGraph); // TODO max chart span
|
||||
|
||||
featuresRemaining = &FeatureFunction::GetFeatureFunctions();
|
||||
}
|
||||
|
||||
m_decodeGraphs[decodeGraphInd]->Add(decodeStep);
|
||||
|
@ -167,28 +167,6 @@ void TargetPhrase::SetInputScore(const Scores &scoreVector)
|
||||
m_scoreBreakdown.Assign(prod, sizedScoreVector);
|
||||
}
|
||||
|
||||
TargetPhrase *TargetPhrase::MergeNext(const TargetPhrase &inputPhrase) const
|
||||
{
|
||||
if (! IsCompatible(inputPhrase)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// ok, merge
|
||||
TargetPhrase *clone = new TargetPhrase(*this);
|
||||
clone->m_sourcePhrase = m_sourcePhrase;
|
||||
int currWord = 0;
|
||||
const size_t len = GetSize();
|
||||
for (size_t currPos = 0 ; currPos < len ; currPos++) {
|
||||
const Word &inputWord = inputPhrase.GetWord(currPos);
|
||||
Word &cloneWord = clone->GetWord(currPos);
|
||||
cloneWord.Merge(inputWord);
|
||||
|
||||
currWord++;
|
||||
}
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
void TargetPhrase::SetAlignmentInfo(const StringPiece &alignString)
|
||||
{
|
||||
AlignmentInfo::CollType alignTerm, alignNonTerm;
|
||||
@ -233,6 +211,12 @@ void TargetPhrase::SetSparseScore(const FeatureFunction* translationScoreProduce
|
||||
m_scoreBreakdown.Assign(translationScoreProducer, sparseString.as_string());
|
||||
}
|
||||
|
||||
void TargetPhrase::Merge(const TargetPhrase ©, const std::vector<FactorType>& factorVec)
|
||||
{
|
||||
Phrase::MergeFactors(copy, factorVec);
|
||||
m_scoreBreakdown.Merge(copy.GetScoreBreakdown());
|
||||
}
|
||||
|
||||
TO_STRING_BODY(TargetPhrase);
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const TargetPhrase& tp)
|
||||
|
@ -71,9 +71,6 @@ public:
|
||||
void SetXMLScore(float score);
|
||||
void SetInputScore(const Scores &scoreVector);
|
||||
|
||||
TargetPhrase *MergeNext(const TargetPhrase &targetPhrase) const;
|
||||
// used for translation step
|
||||
|
||||
#ifdef HAVE_PROTOBUF
|
||||
void WriteToRulePB(hgmert::Rule* pb) const;
|
||||
#endif
|
||||
@ -128,6 +125,7 @@ public:
|
||||
return *m_alignNonTerm;
|
||||
}
|
||||
|
||||
void Merge(const TargetPhrase ©, const std::vector<FactorType>& factorVec);
|
||||
|
||||
TO_STRING();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user