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

SearchNormal.h « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 35ed27199d083f76fccc2113308670d7a92dd604 (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
58
59
60
61
62
63
64
65
66
#ifndef moses_SearchNormal_h
#define moses_SearchNormal_h

#include <vector>
#include "Search.h"
#include "HypothesisStackNormal.h"
#include "TranslationOptionCollection.h"
#include "Timer.h"

namespace Moses
{

class Manager;
class TranslationOptionCollection;

/** Functions and variables you need to decoder an input using the
 *  phrase-based decoder (NO cube-pruning)
 *  Instantiated by the Manager class
 */
class SearchNormal: public Search
{
protected:
  //! stacks to store hypotheses (partial translations)
  // no of elements = no of words in source + 1
  std::vector < HypothesisStack* > m_hypoStackColl;

  /** actual (full expanded) stack of hypotheses*/
  HypothesisStackNormal* actual_hypoStack;

  /** pre-computed list of translation options for the phrases in this sentence */
  const TranslationOptionCollection &m_transOptColl;

  // functions for creating hypotheses

  virtual bool
  ProcessOneStack(HypothesisStack* hstack);

  virtual void
  ProcessOneHypothesis(const Hypothesis &hypothesis);

  virtual void
  ExpandAllHypotheses(const Hypothesis &hypothesis, size_t startPos, size_t endPos);

  virtual void
  ExpandHypothesis(const Hypothesis &hypothesis,
                   const TranslationOption &transOpt,
                   float expectedScore,
                   float estimatedScore,
                   const Bitmap &bitmap);

public:
  SearchNormal(Manager& manager, const TranslationOptionCollection &transOptColl);
  ~SearchNormal();

  void Decode();

  void OutputHypoStackSize();
  void OutputHypoStack();

  virtual const std::vector < HypothesisStack* >& GetHypothesisStacks() const;
  virtual const Hypothesis *GetBestHypothesis() const;
};

}

#endif