2015-10-24 21:54:16 +03:00
|
|
|
/*
|
|
|
|
* Hypothesis.h
|
|
|
|
*
|
|
|
|
* Created on: 24 Oct 2015
|
|
|
|
* Author: hieu
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HYPOTHESIS_H_
|
|
|
|
#define HYPOTHESIS_H_
|
|
|
|
|
2015-10-27 00:11:47 +03:00
|
|
|
#include <iostream>
|
2015-10-24 21:54:16 +03:00
|
|
|
#include <cstddef>
|
|
|
|
#include "moses/FF/FFState.h"
|
2015-10-25 18:58:26 +03:00
|
|
|
#include "moses/Bitmap.h"
|
2015-10-27 15:51:57 +03:00
|
|
|
#include "Scores.h"
|
2015-10-24 21:54:16 +03:00
|
|
|
|
|
|
|
class Manager;
|
2015-10-26 00:46:30 +03:00
|
|
|
class TargetPhrase;
|
2015-10-27 00:11:47 +03:00
|
|
|
class Scores;
|
2015-10-24 21:54:16 +03:00
|
|
|
|
|
|
|
class Hypothesis {
|
2015-10-26 19:32:47 +03:00
|
|
|
friend std::ostream& operator<<(std::ostream &, const Hypothesis &);
|
2015-10-24 21:54:16 +03:00
|
|
|
public:
|
2015-10-26 01:38:08 +03:00
|
|
|
Hypothesis(Manager &mgr,
|
|
|
|
const TargetPhrase &tp,
|
|
|
|
const Moses::Range &range,
|
|
|
|
const Moses::Bitmap &bitmap);
|
|
|
|
Hypothesis(const Hypothesis &prevHypo,
|
|
|
|
const TargetPhrase &tp,
|
|
|
|
const Moses::Range &pathRange,
|
|
|
|
const Moses::Bitmap &bitmap);
|
2015-10-24 21:54:16 +03:00
|
|
|
virtual ~Hypothesis();
|
|
|
|
|
|
|
|
size_t hash() const;
|
|
|
|
bool operator==(const Hypothesis &other) const;
|
|
|
|
|
2015-10-25 18:58:26 +03:00
|
|
|
const Moses::Bitmap &GetBitmap() const
|
2015-10-26 22:31:39 +03:00
|
|
|
{ return m_sourceCompleted; }
|
2015-10-25 15:49:25 +03:00
|
|
|
|
2015-10-25 18:58:26 +03:00
|
|
|
const Moses::Range &GetRange() const
|
2015-10-25 15:49:25 +03:00
|
|
|
{ return m_range; }
|
|
|
|
|
2015-10-27 00:11:47 +03:00
|
|
|
const Scores &GetScores() const
|
|
|
|
{ return *m_scores; }
|
|
|
|
|
|
|
|
void OutputToStream(std::ostream &out) const;
|
|
|
|
|
2015-10-24 21:54:16 +03:00
|
|
|
protected:
|
2015-10-25 19:35:20 +03:00
|
|
|
Manager &m_mgr;
|
2015-10-26 01:38:08 +03:00
|
|
|
const TargetPhrase &m_targetPhrase;
|
2015-10-26 22:31:39 +03:00
|
|
|
const Moses::Bitmap &m_sourceCompleted;
|
2015-10-25 18:58:26 +03:00
|
|
|
const Moses::Range &m_range;
|
2015-10-26 01:41:06 +03:00
|
|
|
const Hypothesis *m_prevHypo;
|
2015-10-25 14:47:47 +03:00
|
|
|
|
2015-10-24 21:54:16 +03:00
|
|
|
Moses::FFState **m_ffStates;
|
2015-10-27 00:11:47 +03:00
|
|
|
Scores *m_scores;
|
2015-10-24 21:54:16 +03:00
|
|
|
};
|
|
|
|
|
2015-10-27 15:51:57 +03:00
|
|
|
|
|
|
|
class HypothesisScoreOrderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool operator()(const Hypothesis* a, const Hypothesis* b) const {
|
|
|
|
return a->GetScores().GetTotalScore() > b->GetScores().GetTotalScore();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-10-24 21:54:16 +03:00
|
|
|
#endif /* HYPOTHESIS_H_ */
|