mosesdecoder/moses/Search.h

56 lines
1.3 KiB
C
Raw Normal View History

#ifndef moses_Search_h
#define moses_Search_h
#include <vector>
#include "TypeDef.h"
#include "TranslationOption.h"
#include "Phrase.h"
#include "InputPath.h"
#include "Bitmaps.h"
namespace Moses
{
class HypothesisStack;
class Hypothesis;
class InputType;
class TranslationOptionCollection;
class Manager;
class Phrase;
/** 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
*/
class Search
{
public:
virtual const std::vector<HypothesisStack*>& GetHypothesisStacks() const = 0;
virtual const Hypothesis *GetBestHypothesis() const = 0;
//! Decode the sentence according to the specified search algorithm.
2014-12-26 10:41:52 +03:00
virtual void Decode() = 0;
2015-12-07 19:07:11 +03:00
explicit Search(Manager& manager);
virtual ~Search() {}
protected:
Manager& m_manager;
const InputType &m_source;
AllOptions const& m_options;
InputPath m_inputPath; // for initial hypo
TranslationOption m_initialTransOpt; /**< used to seed 1st hypo */
Bitmaps m_bitmaps;
/** flag indicating that decoder ran out of time (see switch -time-out) */
2015-08-08 02:00:45 +03:00
size_t interrupted_flag;
bool out_of_time();
};
}
#endif