|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once |
|
#include <string> |
|
|
|
namespace Moses2 |
|
{ |
|
|
|
class MemPool; |
|
class Range; |
|
class Bitmap; |
|
class LRState; |
|
class LexicalReordering; |
|
|
|
class LRModel |
|
{ |
|
public: |
|
enum ModelType { |
|
Monotonic, MSD, MSLR, LeftRight, None |
|
}; |
|
enum Direction { |
|
Forward, Backward, Bidirectional |
|
}; |
|
enum Condition { |
|
F, E, FE |
|
}; |
|
|
|
enum ReorderingType { |
|
M = 0, |
|
NM = 1, |
|
S = 1, |
|
D = 2, |
|
DL = 2, |
|
DR = 3, |
|
R = 0, |
|
L = 1, |
|
MAX = 3, |
|
NONE = 4 |
|
}; |
|
|
|
LRModel(const std::string &modelType, LexicalReordering &ff); |
|
virtual ~LRModel(); |
|
|
|
ModelType GetModelType() const { |
|
return m_modelType; |
|
} |
|
Direction GetDirection() const { |
|
return m_direction; |
|
} |
|
Condition GetCondition() const { |
|
return m_condition; |
|
} |
|
|
|
bool IsPhraseBased() const { |
|
return m_phraseBased; |
|
} |
|
|
|
bool CollapseScores() const { |
|
return m_collapseScores; |
|
} |
|
|
|
size_t GetNumberOfTypes() const; |
|
|
|
LexicalReordering* |
|
GetScoreProducer() const { |
|
return m_scoreProducer; |
|
} |
|
|
|
LRState *CreateLRState(MemPool &pool) const; |
|
|
|
ReorderingType |
|
GetOrientation(Range const& cur) const; |
|
|
|
ReorderingType |
|
GetOrientation(Range const& prev, Range const& cur) const; |
|
|
|
ReorderingType |
|
GetOrientation(Range const& prev, Range const& cur, Bitmap const& cov) const; |
|
|
|
ReorderingType |
|
GetOrientation(int const reoDistance) const; |
|
|
|
protected: |
|
|
|
ModelType m_modelType; |
|
bool m_phraseBased; |
|
bool m_collapseScores; |
|
Direction m_direction; |
|
Condition m_condition; |
|
LexicalReordering *m_scoreProducer; |
|
|
|
}; |
|
|
|
} |
|
|
|
|