|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef moses_DecodeGraph_h |
|
|
#define moses_DecodeGraph_h |
|
|
|
|
|
#include "util/exception.hh" |
|
|
#include <list> |
|
|
#include <iterator> |
|
|
#include "TypeDef.h" |
|
|
|
|
|
namespace Moses |
|
|
{ |
|
|
|
|
|
class DecodeStep; |
|
|
|
|
|
|
|
|
class DecodeGraph |
|
|
{ |
|
|
protected: |
|
|
std::list<const DecodeStep*> m_steps; |
|
|
size_t m_id; |
|
|
size_t m_maxChartSpan; |
|
|
size_t m_backoff; |
|
|
|
|
|
public: |
|
|
|
|
|
|
|
|
|
|
|
DecodeGraph(size_t id) |
|
|
: m_id(id) |
|
|
, m_maxChartSpan(NOT_FOUND) |
|
|
, m_backoff(0) { |
|
|
} |
|
|
|
|
|
|
|
|
DecodeGraph(size_t id, size_t maxChartSpan) |
|
|
: m_id(id) |
|
|
, m_maxChartSpan(maxChartSpan) { |
|
|
} |
|
|
|
|
|
|
|
|
typedef std::list<const DecodeStep*>::iterator iterator; |
|
|
typedef std::list<const DecodeStep*>::const_iterator const_iterator; |
|
|
const_iterator begin() const { |
|
|
return m_steps.begin(); |
|
|
} |
|
|
const_iterator end() const { |
|
|
return m_steps.end(); |
|
|
} |
|
|
|
|
|
virtual ~DecodeGraph(); |
|
|
|
|
|
|
|
|
void Add(DecodeStep *decodeStep); |
|
|
|
|
|
size_t GetSize() const { |
|
|
return m_steps.size(); |
|
|
} |
|
|
|
|
|
size_t GetMaxChartSpan() const { |
|
|
UTIL_THROW_IF2(m_maxChartSpan == NOT_FOUND, "Max chart span not specified"); |
|
|
return m_maxChartSpan; |
|
|
} |
|
|
|
|
|
size_t GetBackoff() const { |
|
|
return m_backoff; |
|
|
} |
|
|
|
|
|
void SetBackoff(size_t backoff) { |
|
|
m_backoff = backoff; |
|
|
} |
|
|
|
|
|
size_t GetId() const { |
|
|
return m_id; |
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
} |
|
|
#endif |
|
|
|