Moses::ReorderingConstraint Class Reference

#include <ReorderingConstraint.h>

List of all members.

Public Member Functions

 ReorderingConstraint (int max_distortion)
 create ReorderingConstraint of length size and initialise to zero
 ~ReorderingConstraint ()
 destructer
void InitializeWalls (size_t size)
 allocate memory for memory for a sentence of a given size
void FinalizeWalls ()
 changes walls in zones into local walls
void SetWall (size_t pos, bool value)
 set value at a particular position
bool GetWall (size_t pos) const
 whether a word has been translated at a particular position
bool GetLocalWall (size_t pos, size_t zone) const
 whether a word has been translated at a particular position
void SetZone (size_t startPos, size_t endPos)
 set a zone
std::vector< std::pair< size_t,
size_t > > & 
GetZones ()
 returns the vector of zones
void SetMonotoneAtPunctuation (const Phrase &sentence)
 set the reordering walls based on punctuation in the sentence
bool Check (const Bitmap &bitmap, size_t start, size_t end) const
 check if all constraints are fulfilled -> all find
bool IsActive () const
 checks if reordering constraints will be enforced

Protected Attributes

size_t m_size
bool * m_wall
size_t * m_localWall
std::vector< std::pair< size_t,
size_t > > 
m_zone
bool m_active
int m_max_distortion

Friends

std::ostream & operator<< (std::ostream &out, const ReorderingConstraint &obj)


Detailed Description

A list of zones and walls to limit which reordering can occur

Definition at line 46 of file ReorderingConstraint.h.


Constructor & Destructor Documentation

Moses::ReorderingConstraint::ReorderingConstraint ( int  max_distortion  )  [inline]

create ReorderingConstraint of length size and initialise to zero

Definition at line 60 of file ReorderingConstraint.h.

Moses::ReorderingConstraint::~ReorderingConstraint (  )  [inline]

destructer

Definition at line 68 of file ReorderingConstraint.h.

References m_localWall, m_wall, and NULL.


Member Function Documentation

bool Moses::ReorderingConstraint::Check ( const Bitmap bitmap,
size_t  start,
size_t  end 
) const

check if all constraints are fulfilled -> all find

check if the current hypothesis extension violates reordering constraints

Definition at line 108 of file ReorderingConstraint.cpp.

References Moses::Bitmap::GetFirstGapPos(), Moses::Bitmap::GetLastPos(), GetLocalWall(), Moses::Bitmap::GetValue(), GetWall(), IsActive(), m_max_distortion, m_zone, NOT_FOUND, and VERBOSE.

Referenced by Moses::SearchCubePruning::CheckDistortion(), and Moses::SearchNormal::ProcessOneHypothesis().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::ReorderingConstraint::FinalizeWalls (  ) 

changes walls in zones into local walls

has to be called to localized walls

Definition at line 54 of file ReorderingConstraint.cpp.

References m_localWall, m_wall, m_zone, NOT_A_ZONE, and VERBOSE.

bool Moses::ReorderingConstraint::GetLocalWall ( size_t  pos,
size_t  zone 
) const [inline]

whether a word has been translated at a particular position

Definition at line 88 of file ReorderingConstraint.h.

References m_localWall.

Referenced by Check().

Here is the caller graph for this function:

bool Moses::ReorderingConstraint::GetWall ( size_t  pos  )  const [inline]

whether a word has been translated at a particular position

Definition at line 83 of file ReorderingConstraint.h.

References m_wall.

Referenced by Check().

Here is the caller graph for this function:

std::vector< std::pair<size_t,size_t> >& Moses::ReorderingConstraint::GetZones (  )  [inline]

returns the vector of zones

Definition at line 96 of file ReorderingConstraint.h.

References m_zone.

void Moses::ReorderingConstraint::InitializeWalls ( size_t  size  ) 

allocate memory for memory for a sentence of a given size

allocate memory for reordering walls

Definition at line 32 of file ReorderingConstraint.cpp.

References m_localWall, m_size, m_wall, and NOT_A_ZONE.

bool Moses::ReorderingConstraint::IsActive (  )  const [inline]

checks if reordering constraints will be enforced

Definition at line 107 of file ReorderingConstraint.h.

References m_active.

Referenced by Check().

Here is the caller graph for this function:

void Moses::ReorderingConstraint::SetMonotoneAtPunctuation ( const Phrase sentence  ) 

set the reordering walls based on punctuation in the sentence

set walls based on "-monotone-at-punctuation" flag

Definition at line 78 of file ReorderingConstraint.cpp.

References Moses::Phrase::GetSize(), Moses::Phrase::GetWord(), m_size, and SetWall().

Here is the call graph for this function:

void Moses::ReorderingConstraint::SetWall ( size_t  pos,
bool  value 
)

set value at a particular position

Definition at line 46 of file ReorderingConstraint.cpp.

References m_active, m_wall, and VERBOSE.

Referenced by SetMonotoneAtPunctuation().

Here is the caller graph for this function:

void Moses::ReorderingConstraint::SetZone ( size_t  startPos,
size_t  endPos 
)

set a zone

set a reordering zone (once entered, need to finish)

Definition at line 97 of file ReorderingConstraint.cpp.

References m_active, m_zone, and VERBOSE.

Referenced by Moses::ProcessAndStripXMLTags().

Here is the caller graph for this function:


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const ReorderingConstraint obj 
) [friend]

Definition at line 239 of file ReorderingConstraint.cpp.


Member Data Documentation

zones that limit reordering flag indicating, if there are any active constraints

Definition at line 55 of file ReorderingConstraint.h.

Referenced by IsActive(), SetWall(), and SetZone().

flag for each word if it is a local wall

Definition at line 53 of file ReorderingConstraint.h.

Referenced by FinalizeWalls(), GetLocalWall(), InitializeWalls(), Moses::operator<<(), and ~ReorderingConstraint().

Definition at line 56 of file ReorderingConstraint.h.

Referenced by Check().

number of words in sentence

Definition at line 51 of file ReorderingConstraint.h.

Referenced by InitializeWalls(), Moses::operator<<(), and SetMonotoneAtPunctuation().

flag for each word if it is a wall

Definition at line 52 of file ReorderingConstraint.h.

Referenced by FinalizeWalls(), GetWall(), InitializeWalls(), Moses::operator<<(), SetWall(), and ~ReorderingConstraint().

std::vector< std::pair<size_t,size_t> > Moses::ReorderingConstraint::m_zone [protected]

Definition at line 54 of file ReorderingConstraint.h.

Referenced by Check(), FinalizeWalls(), GetZones(), Moses::operator<<(), and SetZone().


The documentation for this class was generated from the following files:

Generated on Thu Jul 6 00:33:31 2017 for Moses by  doxygen 1.5.9