2010-02-24 14:15:44 +03:00
|
|
|
#ifndef moses_Search_h
|
|
|
|
#define moses_Search_h
|
2008-06-11 14:52:57 +04:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "TypeDef.h"
|
|
|
|
|
2008-10-09 03:51:26 +04:00
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
2008-06-11 14:52:57 +04:00
|
|
|
class HypothesisStack;
|
|
|
|
class Hypothesis;
|
|
|
|
class InputType;
|
|
|
|
class TranslationOptionCollection;
|
2009-08-07 20:47:54 +04:00
|
|
|
class Manager;
|
2013-04-30 11:20:08 +04:00
|
|
|
class Phrase;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2013-04-30 11:20:08 +04:00
|
|
|
/** Base search class used in the phrase-based decoder.
|
|
|
|
*
|
|
|
|
* Actual search class that implement the cube pruning algorithm (SearchCubePruning)
|
|
|
|
* or standard beam search (SearchNormal) should inherits from this class, and
|
|
|
|
* override pure virtual functions.
|
2012-06-29 02:29:46 +04:00
|
|
|
*/
|
2008-06-11 14:52:57 +04:00
|
|
|
class Search
|
|
|
|
{
|
|
|
|
public:
|
2013-04-30 11:20:08 +04:00
|
|
|
virtual const std::vector<HypothesisStack*>& GetHypothesisStacks() const = 0;
|
2011-02-24 16:14:42 +03:00
|
|
|
virtual const Hypothesis *GetBestHypothesis() const = 0;
|
2013-04-30 11:20:08 +04:00
|
|
|
|
|
|
|
//! Decode the sentence according to the specified search algorithm.
|
2011-02-24 16:14:42 +03:00
|
|
|
virtual void ProcessSentence() = 0;
|
2008-06-11 14:52:57 +04:00
|
|
|
|
2013-04-30 11:20:08 +04:00
|
|
|
explicit Search(Manager& manager) : m_manager(manager) {}
|
|
|
|
virtual ~Search() {}
|
|
|
|
|
|
|
|
// Factory method
|
2011-02-24 16:14:42 +03:00
|
|
|
static Search *CreateSearch(Manager& manager, const InputType &source, SearchAlgorithm searchAlgorithm,
|
2009-08-07 20:47:54 +04:00
|
|
|
const TranslationOptionCollection &transOptColl);
|
2008-06-19 03:14:09 +04:00
|
|
|
|
|
|
|
protected:
|
2011-02-24 16:14:42 +03:00
|
|
|
const Phrase *m_constraint;
|
2009-08-07 20:47:54 +04:00
|
|
|
Manager& m_manager;
|
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
|