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

ScoreStsg.h « score-stsg « phrase-extract - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1757e181bca1cf4c711b7b3641f7ec583e7299da (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
67
68
69
#pragma once

#include <map>
#include <ostream>
#include <set>
#include <string>
#include <vector>

#include "ExtractionPhrasePair.h"
#include "OutputFileStream.h"

#include "syntax-common/tool.h"

#include "LexicalTable.h"
#include "Options.h"
#include "RuleSymbol.h"
#include "TokenizedRuleHalf.h"
#include "Vocabulary.h"

namespace MosesTraining
{
namespace Syntax
{
namespace ScoreStsg
{

class RuleGroup;
class RuleTableWriter;

class ScoreStsg : public Tool
{
public:
  ScoreStsg();

  virtual int Main(int argc, char *argv[]);

private:
  static const int kCountOfCountsMax;

  double ComputeLexProb(const std::vector<RuleSymbol> &,
                        const std::vector<RuleSymbol> &,
                        const ALIGNMENT &);

  void ParseAlignmentString(const std::string &, int,
                            ALIGNMENT &);

  void ProcessOptions(int, char *[], Options &) const;

  void ProcessRuleGroup(const RuleGroup &, RuleTableWriter &);

  void ProcessRuleGroupOrDie(const RuleGroup &, RuleTableWriter &,
                             std::size_t, std::size_t);

  void TokenizeRuleHalf(const std::string &, TokenizedRuleHalf &);

  Options m_options;
  Vocabulary m_srcVocab;
  Vocabulary m_tgtVocab;
  LexicalTable m_lexTable;
  std::vector<int> m_countOfCounts;
  int m_totalDistinct;
  TokenizedRuleHalf m_sourceHalf;
  TokenizedRuleHalf m_targetHalf;
  ALIGNMENT m_tgtToSrc;
};

}  // namespace ScoreStsg
}  // namespace Syntax
}  // namespace MosesTraining