mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-06 19:49:41 +03:00
turn references into pointers. For next refactoring
This commit is contained in:
parent
c2d3e4f5c9
commit
feeb46808b
@ -20,9 +20,9 @@ Hypothesis::Hypothesis(Manager &mgr,
|
||||
const Moses::Range &range,
|
||||
const Moses::Bitmap &bitmap)
|
||||
:m_mgr(mgr)
|
||||
,m_targetPhrase(tp)
|
||||
,m_sourceCompleted(bitmap)
|
||||
,m_range(range)
|
||||
,m_targetPhrase(&tp)
|
||||
,m_sourceCompleted(&bitmap)
|
||||
,m_range(&range)
|
||||
,m_prevHypo(NULL)
|
||||
,m_currTargetWordsRange(NOT_FOUND, NOT_FOUND)
|
||||
{
|
||||
@ -39,9 +39,9 @@ Hypothesis::Hypothesis(const Hypothesis &prevHypo,
|
||||
const Moses::Range &pathRange,
|
||||
const Moses::Bitmap &bitmap)
|
||||
:m_mgr(prevHypo.m_mgr)
|
||||
,m_targetPhrase(tp)
|
||||
,m_sourceCompleted(bitmap)
|
||||
,m_range(pathRange)
|
||||
,m_targetPhrase(&tp)
|
||||
,m_sourceCompleted(&bitmap)
|
||||
,m_range(&pathRange)
|
||||
,m_prevHypo(&prevHypo)
|
||||
,m_currTargetWordsRange(prevHypo.m_currTargetWordsRange.GetEndPos() + 1,
|
||||
prevHypo.m_currTargetWordsRange.GetEndPos()
|
||||
@ -56,7 +56,7 @@ Hypothesis::Hypothesis(const Hypothesis &prevHypo,
|
||||
Scores(pool,
|
||||
m_mgr.GetSystem().GetFeatureFunctions().GetNumScores(),
|
||||
prevHypo.GetScores());
|
||||
m_scores->PlusEquals(m_mgr.GetSystem(), m_targetPhrase.GetScores());
|
||||
m_scores->PlusEquals(m_mgr.GetSystem(), GetTargetPhrase().GetScores());
|
||||
}
|
||||
|
||||
Hypothesis::~Hypothesis() {
|
||||
@ -107,8 +107,8 @@ void Hypothesis::OutputToStream(std::ostream &out) const
|
||||
m_prevHypo->OutputToStream(out);
|
||||
}
|
||||
|
||||
if (m_targetPhrase.GetSize()) {
|
||||
const Phrase &phrase = m_targetPhrase;
|
||||
if (GetTargetPhrase().GetSize()) {
|
||||
const Phrase &phrase = GetTargetPhrase();
|
||||
out << phrase << " ";
|
||||
}
|
||||
}
|
||||
|
@ -37,10 +37,10 @@ public:
|
||||
bool operator==(const Hypothesis &other) const;
|
||||
|
||||
inline const Moses::Bitmap &GetBitmap() const
|
||||
{ return m_sourceCompleted; }
|
||||
{ return *m_sourceCompleted; }
|
||||
|
||||
inline const Moses::Range &GetRange() const
|
||||
{ return m_range; }
|
||||
{ return *m_range; }
|
||||
|
||||
inline const Moses::Range &GetCurrTargetWordsRange() const {
|
||||
return m_currTargetWordsRange;
|
||||
@ -50,7 +50,7 @@ public:
|
||||
{ return *m_scores; }
|
||||
|
||||
const TargetPhrase &GetTargetPhrase() const
|
||||
{ return m_targetPhrase; }
|
||||
{ return *m_targetPhrase; }
|
||||
|
||||
const Moses::FFState *GetState(size_t ind) const
|
||||
{ return m_ffStates[ind]; }
|
||||
@ -68,7 +68,7 @@ public:
|
||||
* (ie, start of sentence would be some negative number, which is
|
||||
* not allowed- USE WITH CAUTION) */
|
||||
inline const Word &GetCurrWord(size_t pos) const {
|
||||
return m_targetPhrase[pos];
|
||||
return GetTargetPhrase()[pos];
|
||||
}
|
||||
|
||||
/** recursive - pos is relative from start of sentence */
|
||||
@ -76,9 +76,9 @@ public:
|
||||
|
||||
protected:
|
||||
Manager &m_mgr;
|
||||
const TargetPhrase &m_targetPhrase;
|
||||
const Moses::Bitmap &m_sourceCompleted;
|
||||
const Moses::Range &m_range;
|
||||
const TargetPhrase *m_targetPhrase;
|
||||
const Moses::Bitmap *m_sourceCompleted;
|
||||
const Moses::Range *m_range;
|
||||
const Hypothesis *m_prevHypo;
|
||||
|
||||
const Moses::FFState **m_ffStates;
|
||||
|
Loading…
Reference in New Issue
Block a user