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

TargetWordInsertionFeature.h « src « moses - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0d53582d50a4be86dfc1fb5eda129a17cb2f89ce (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
#ifndef moses_TargetWordInsertionFeature_h
#define moses_TargetWordInsertionFeature_h

#include <string>
#include <map>

#include "FeatureFunction.h"
#include "FactorCollection.h"
#include "AlignmentInfo.h"

namespace Moses
{

/** Sets the features for length of source phrase, target phrase, both.
 */
class TargetWordInsertionFeature : public StatelessFeatureFunction {
private:
  std::set<std::string> m_vocab;
  FactorType m_factorType;
  bool m_unrestricted;

public:
	TargetWordInsertionFeature(FactorType factorType = 0):
     StatelessFeatureFunction("twi", ScoreProducer::unlimited),
     m_factorType(factorType),
     m_unrestricted(true)
  {
		std::cerr << "Initializing target word insertion feature.." << std::endl;
  }
      
  bool Load(const std::string &filePath);
  void Evaluate(const Hypothesis& cur_hypo,
                ScoreComponentCollection* accumulator) const;

  void EvaluateChart(
    const ChartHypothesis& cur_hypo,
    int featureID,
    ScoreComponentCollection* accumulator) const;

  void ComputeFeatures(const TargetPhrase& targetPhrase,
		           	   ScoreComponentCollection* accumulator,
		           	   const AlignmentInfo::CollType &alignment) const;

  // basic properties
	std::string GetScoreProducerWeightShortName(unsigned) const { return "twi"; }
	size_t GetNumInputScores() const { return 0; }
};

}

#endif // moses_TargetWordInsertionFeature_h