summaryrefslogtreecommitdiff
path: root/extractor/grammar_extractor.h
blob: 05e153fc7e78c48f10cd3b7cace38eb06684104f (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
#ifndef _GRAMMAR_EXTRACTOR_H_
#define _GRAMMAR_EXTRACTOR_H_

#include <string>
#include <vector>

#include "rule_factory.h"
#include "vocabulary.h"

using namespace std;

class Alignment;
class DataArray;
class Precomputation;
class SuffixArray;

class GrammarExtractor {
 public:
  GrammarExtractor(
      shared_ptr<SuffixArray> source_suffix_array,
      shared_ptr<DataArray> target_data_array,
      const Alignment& alignment,
      const Precomputation& precomputation,
      int min_gap_size,
      int max_rule_span,
      int max_nonterminals,
      int max_rule_symbols,
      bool use_baeza_yates);

  void GetGrammar(const string& sentence);

 private:
  vector<int> AnnotateWords(const vector<string>& words);

  shared_ptr<Vocabulary> vocabulary;
  HieroCachingRuleFactory rule_factory;
};

#endif