diff options
author | redpony <redpony@1f5c12ca-751b-0410-a591-d2e778427230> | 2007-09-28 19:44:53 +0400 |
---|---|---|
committer | redpony <redpony@1f5c12ca-751b-0410-a591-d2e778427230> | 2007-09-28 19:44:53 +0400 |
commit | d2928a0653365dd94148cf45516032a9418ab2b9 (patch) | |
tree | 94e4ca46a95db26f7c0e6f8e239fec307864cd63 /moses | |
parent | 17884106d4fd7fd75774a879fe066dcce1b50771 (diff) |
fix tracking of source phrases in CNs/Word Lattices
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1467 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses')
-rwxr-xr-x | moses/src/Hypothesis.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/moses/src/Hypothesis.cpp b/moses/src/Hypothesis.cpp index d8d909d26..53e450eb6 100755 --- a/moses/src/Hypothesis.cpp +++ b/moses/src/Hypothesis.cpp @@ -72,7 +72,7 @@ Hypothesis::Hypothesis(const Hypothesis &prevHypo, const TranslationOption &tran : m_prevHypo(&prevHypo) , m_transOpt(&transOpt) , m_targetPhrase(transOpt.GetTargetPhrase()) - , m_sourcePhrase(0) + , m_sourcePhrase(transOpt.GetSourcePhrase()) , m_sourceCompleted (prevHypo.m_sourceCompleted ) , m_sourceInput (prevHypo.m_sourceInput) , m_currSourceWordsRange (transOpt.GetSourceWordsRange()) @@ -403,7 +403,8 @@ void Hypothesis::PrintHypothesis(const InputType &source, float /*weightDistorti } TRACE_ERR( ")"<<endl); TRACE_ERR( "\tbase score "<< (m_prevHypo->m_totalScore - m_prevHypo->m_futureScore) <<endl); - TRACE_ERR( "\tcovering "<<m_currSourceWordsRange.GetStartPos()<<"-"<<m_currSourceWordsRange.GetEndPos()<<": "<< source.GetSubString(m_currSourceWordsRange) <<endl); + TRACE_ERR( "\tcovering "<<m_currSourceWordsRange.GetStartPos()<<"-"<<m_currSourceWordsRange.GetEndPos()<<": " + << *m_sourcePhrase <<endl); TRACE_ERR( "\ttranslated as: "<<m_targetPhrase<<endl); // <<" => translation cost "<<m_score[ScoreType::PhraseTrans]; if (m_wordDeleted) TRACE_ERR( "\tword deleted"<<endl); // TRACE_ERR( "\tdistance: "<<GetCurrSourceWordsRange().CalcDistortion(m_prevHypo->GetCurrSourceWordsRange())); // << " => distortion cost "<<(m_score[ScoreType::Distortion]*weightDistortion)<<endl; @@ -475,6 +476,8 @@ ostream& operator<<(ostream& out, const Hypothesis& hypothesis) std::string Hypothesis::GetSourcePhraseStringRep(const vector<FactorType> factorsToPrint) const { if (!m_prevHypo) { return ""; } + return m_sourcePhrase->GetStringRep(factorsToPrint); +#if 0 if(m_sourcePhrase) { return m_sourcePhrase->GetSubString(m_currSourceWordsRange).GetStringRep(factorsToPrint); @@ -483,6 +486,7 @@ std::string Hypothesis::GetSourcePhraseStringRep(const vector<FactorType> factor { return m_sourceInput.GetSubString(m_currSourceWordsRange).GetStringRep(factorsToPrint); } +#endif } std::string Hypothesis::GetTargetPhraseStringRep(const vector<FactorType> factorsToPrint) const { |