2010-02-24 14:15:44 +03:00
|
|
|
#ifndef moses_SearchCubePruning_h
|
|
|
|
#define moses_SearchCubePruning_h
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "Search.h"
|
|
|
|
#include "HypothesisStackCubePruning.h"
|
2013-09-25 19:57:01 +04:00
|
|
|
#include "SentenceStats.h"
|
2008-10-09 03:51:26 +04:00
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
class InputType;
|
|
|
|
class TranslationOptionCollection;
|
|
|
|
|
2012-06-29 02:29:46 +04:00
|
|
|
/** Functions and variables you need to decoder an input using the phrase-based decoder with cube-pruning
|
|
|
|
* Instantiated by the Manager class
|
|
|
|
*/
|
2008-06-11 14:52:57 +04:00
|
|
|
class SearchCubePruning: public Search
|
|
|
|
{
|
|
|
|
protected:
|
2011-02-24 16:14:42 +03:00
|
|
|
std::vector < HypothesisStack* > m_hypoStackColl; /**< stacks to store hypotheses (partial translations) */
|
|
|
|
// no of elements = no of words in source + 1
|
|
|
|
const TranslationOptionCollection &m_transOptColl; /**< pre-computed list of translation options for the phrases in this sentence */
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2011-02-24 16:14:42 +03:00
|
|
|
//! go thru all bitmaps in 1 stack & create backpointers to bitmaps in the stack
|
|
|
|
void CreateForwardTodos(HypothesisStackCubePruning &stack);
|
|
|
|
//! create a back pointer to this bitmap, with edge that has this words range translation
|
2015-10-25 16:37:59 +03:00
|
|
|
void CreateForwardTodos(const Bitmap &bitmap, const Range &range, BitmapContainer &bitmapContainer);
|
|
|
|
bool CheckDistortion(const Bitmap &bitmap, const Range &range) const;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2011-02-24 16:14:42 +03:00
|
|
|
void PrintBitmapContainerGraph();
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
public:
|
2015-12-07 19:07:11 +03:00
|
|
|
SearchCubePruning(Manager& manager, const TranslationOptionCollection &transOptColl);
|
2011-02-24 16:14:42 +03:00
|
|
|
~SearchCubePruning();
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2014-12-26 10:41:52 +03:00
|
|
|
void Decode();
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2011-02-24 16:14:42 +03:00
|
|
|
void OutputHypoStackSize();
|
|
|
|
void OutputHypoStack(int stack);
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2011-02-24 16:14:42 +03:00
|
|
|
virtual const std::vector < HypothesisStack* >& GetHypothesisStacks() const;
|
|
|
|
virtual const Hypothesis *GetBestHypothesis() const;
|
2008-06-11 14:52:57 +04:00
|
|
|
};
|
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
|
|
|
|
}
|
2010-02-24 14:15:44 +03:00
|
|
|
#endif
|