Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Search.h « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7797f07a056439742b6548e4feb4d364f43513f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#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"
#include "Timer.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.
 */
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.
  virtual void Decode() = 0;

  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) */
  size_t interrupted_flag;

  Timer m_timer;
  bool out_of_time();
};

}
#endif