blob: f50a8d1479b561dc7ac06f0a573a3d00f28f6896 (
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
|
#ifndef _GRAMMAR_EXTRACTOR_H_
#define _GRAMMAR_EXTRACTOR_H_
#include <string>
#include <vector>
#include "rule_factory.h"
using namespace std;
class Alignment;
class DataArray;
class Grammar;
class Precomputation;
class Rule;
class SuffixArray;
class Vocabulary;
class GrammarExtractor {
public:
GrammarExtractor(
shared_ptr<SuffixArray> source_suffix_array,
shared_ptr<DataArray> target_data_array,
shared_ptr<Alignment> alignment,
shared_ptr<Precomputation> precomputation,
shared_ptr<Scorer> scorer,
int min_gap_size,
int max_rule_span,
int max_nonterminals,
int max_rule_symbols,
int max_samples,
bool require_tight_phrases);
// For testing only.
GrammarExtractor(shared_ptr<Vocabulary> vocabulary,
shared_ptr<HieroCachingRuleFactory> rule_factory);
Grammar GetGrammar(const string& sentence);
private:
vector<string> TokenizeSentence(const string& sentence);
vector<int> AnnotateWords(const vector<string>& words);
shared_ptr<Vocabulary> vocabulary;
shared_ptr<HieroCachingRuleFactory> rule_factory;
};
#endif
|